CPN
Computational Process Networks
VariantCPNLoader.h
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
23 #ifndef VARIANTCPNLOADER_H
24 #define VARIANTCPNLOADER_H
25 #pragma once
26 #include <cpn/common.h>
27 #include <cpn/Kernel.h>
28 #include <Variant/Variant.h>
29 #include <utility>
30 
31 namespace CPN {
32 
37  public:
39  VariantCPNLoader(Variant conf);
41 
42  Variant &GetConfig() { return config; }
43  void MergeConfig(Variant v);
44 
45  void KernelName(const std::string &name);
46  void KernelHost(const std::string &host);
47  void KernelPort(const std::string &port);
48  void AddLib(const std::string &filename);
49  void AddLibList(const std::string &filename);
50  void AddLibPath(const std::string &path);
51  void UseD4R(bool value);
52  void GrowQueueMaxThreshold(bool value);
53  void SwallowBrokenQueueExceptions(bool value);
54 
55  // Context functions
56  void LogLevel(int i);
57  void ContextHost(const std::string &host);
58  void ContextPort(const std::string &port);
59 
60  void AddNode(Variant v);
61  void AddQueue(Variant v);
62  void AddNodeMapping(const std::string &noden, const std::string &kernn);
63 
64  std::pair<bool, std::string> Validate() { return Validate(config); }
65 
67  void Setup(CPN::Kernel *kernel) { Setup(kernel, config); }
68 
69  static CPN::shared_ptr<CPN::Context> LoadContext(Variant v);
70  static CPN::KernelAttr GetKernelAttr(Variant args);
71 
72  static void Setup(CPN::Kernel *kernel, Variant args);
73 
74  static void LoadNodes(CPN::Kernel *kernel, Variant nodelist, Variant nodemap);
75  static void LoadNode(CPN::Kernel *kernel, Variant attr, Variant nodemap);
76 
77  static void LoadQueues(CPN::Kernel *kernel, Variant queuelist);
78  static void LoadQueue(CPN::Kernel *kernel, Variant attr);
79 
80  static std::pair<bool, std::string> Validate(Variant conf);
81  private:
82  Variant config;
83  };
84 }
85 #endif
void KernelPort(const std::string &port)
CPN::KernelAttr GetKernelAttr()
void AddLibList(const std::string &filename)
static void LoadNodes(CPN::Kernel *kernel, Variant nodelist, Variant nodemap)
static void LoadNode(CPN::Kernel *kernel, Variant attr, Variant nodemap)
void ContextPort(const std::string &port)
Definition for the kernel object.
The attribute for the Kernel.
Definition: KernelAttr.h:40
static void LoadQueue(CPN::Kernel *kernel, Variant attr)
void GrowQueueMaxThreshold(bool value)
static CPN::shared_ptr< CPN::Context > LoadContext(Variant v)
void AddNodeMapping(const std::string &noden, const std::string &kernn)
static void LoadQueues(CPN::Kernel *kernel, Variant queuelist)
void ContextHost(const std::string &host)
void KernelName(const std::string &name)
void AddLibPath(const std::string &path)
void KernelHost(const std::string &host)
void SwallowBrokenQueueExceptions(bool value)
void AddQueue(Variant v)
void Setup(CPN::Kernel *kernel)
void AddLib(const std::string &filename)
The Kernel declaration.
Definition: Kernel.h:55
void MergeConfig(Variant v)
std::pair< bool, std::string > Validate()
void UseD4R(bool value)