]> SALOME platform Git repositories - modules/yacs.git/blob - src/engine/Runtime.hxx
Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / engine / Runtime.hxx
1 #ifndef _RUNTIME_HXX_
2 #define _RUNTIME_HXX_
3
4 #include "ConversionException.hxx"
5
6 #include<string>
7 #include<set>
8 #include<map>
9 #include<vector>
10
11 namespace YACS
12 {
13   namespace ENGINE
14   {
15     class Runtime;
16     Runtime* getRuntime() throw(Exception);
17
18     class InputPort;
19     class OutputPort;
20     class ForLoop;
21     class ForEachLoop;
22     class WhileLoop;
23     class Switch;
24     class InlineNode;
25     class InlineFuncNode;
26     class ServiceNode;
27     class DataNode;
28     class Container;
29     class ServiceInlineNode;
30     class ComponentInstance;
31     class Proc;
32     class Bloc;
33     class ElementaryNode;
34     class Node;
35     class TypeCode;
36     class InputDataStreamPort;
37     class OutputDataStreamPort;
38     class Catalog;
39     class CatalogLoader;
40
41     class Runtime
42     {
43       friend Runtime* getRuntime() throw(Exception);
44     public:
45       virtual void init() { }
46       virtual void fini() { }
47
48       virtual Catalog* loadCatalog(const std::string& sourceKind,const std::string& path);
49       virtual InlineFuncNode* createFuncNode(const std::string& kind,const std::string& name);
50       virtual InlineNode* createScriptNode(const std::string& kind,const std::string& name);
51
52       virtual ServiceNode* createRefNode(const std::string& kind,const std::string& name);
53       virtual ServiceNode* createCompoNode(const std::string& kind,const std::string& name);
54       virtual ServiceInlineNode *createSInlineNode(const std::string& kind, const std::string& name);
55       virtual DataNode* createInDataNode(const std::string& kind,const std::string& name);
56       virtual DataNode* createOutDataNode(const std::string& kind,const std::string& name);
57
58       virtual ComponentInstance* createComponentInstance(const std::string& name,
59                                                          const std::string& kind="");
60       virtual Container *createContainer(const std::string& kind="");
61       virtual Proc* createProc(const std::string& name);
62       virtual Bloc* createBloc(const std::string& name);
63       virtual WhileLoop* createWhileLoop(const std::string& name);
64       virtual ForLoop* createForLoop(const std::string& name);
65       virtual ForEachLoop* createForEachLoop(const std::string& name,TypeCode * type);
66       virtual Switch* createSwitch(const std::string& name);
67
68       
69       virtual InputPort* createInputPort(const std::string& name,
70                                          const std::string& impl,
71                                          Node * node,
72                                          TypeCode * type) = 0;
73
74       virtual OutputPort* createOutputPort(const std::string& name,
75                                            const std::string& impl,
76                                            Node * node,
77                                            TypeCode * type) = 0;
78
79       virtual InputDataStreamPort* createInputDataStreamPort(const std::string& name,
80                                                              Node * node,
81                                                              TypeCode * type);
82       virtual OutputDataStreamPort* createOutputDataStreamPort(const std::string& name,
83                                                                Node * node,
84                                                                TypeCode * type);
85
86       virtual InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type) throw (ConversionException) = 0;
87
88       virtual void removeRuntime();
89       virtual ~Runtime();
90     public:
91       static const char RUNTIME_ENGINE_INTERACTION_IMPL_NAME[];
92       static  YACS::ENGINE::TypeCode *_tc_double;
93       static  YACS::ENGINE::TypeCode *_tc_int;
94       static  YACS::ENGINE::TypeCode *_tc_bool;
95       static  YACS::ENGINE::TypeCode *_tc_string;
96       static  YACS::ENGINE::TypeCode *_tc_file;
97       virtual void setCatalogLoaderFactory(const std::string& name, CatalogLoader* factory);
98       std::map<std::string,CatalogLoader*> _catalogLoaderFactoryMap;
99       Catalog* getBuiltinCatalog();
100       virtual void addCatalog(Catalog* catalog);
101       virtual TypeCode* getTypeCode(const std::string& name);
102
103     protected:
104       static Runtime* _singleton;
105       Runtime();
106       std::set<std::string> _setOfImplementation;
107       Catalog* _builtinCatalog;
108       std::vector<Catalog*> _catalogs;
109     };
110
111   }
112 }
113 #endif