Salome HOME
copy tag mergefrom_BR_V0_1_CC_Salome_04oct07
[modules/yacs.git] / src / engine / Test / RuntimeForEngineTest.hxx
1 #ifndef __RUNTIMEFORENGINETEST_HXX__
2 #define __RUNTIMEFORENGINETEST_HXX__
3
4 #include "Runtime.hxx"
5 #include "InputPort.hxx"
6 #include "OutputPort.hxx"
7 #include "ElementaryNode.hxx"
8
9 namespace YACS
10 {
11   namespace ENGINE
12   {
13     class TestElemNode: public ElementaryNode
14     {
15     public:
16       TestElemNode(const std::string& s): ElementaryNode(s) { }
17       TestElemNode(const TestElemNode& other, ComposedNode *father);
18       void execute() { }
19     protected:
20       Node *simpleClone(ComposedNode *father, bool editionOnly) const;
21     };
22
23     class TestElemInputPort : public InputPort
24     {
25     public:
26       TestElemInputPort(const std::string& name, Node *node, TypeCode* type);
27       TestElemInputPort(const TestElemInputPort& other, Node *newHelder);
28       void put(const void *data) throw(ConversionException);
29       InputPort *clone(Node *newHelder) const;
30       void *get() const throw(Exception);
31       void exRestoreInit();
32       void exSaveInit();
33     protected:
34       Any *_value;
35     };
36
37     class TestElemOutputPort : public OutputPort
38     {
39     public:
40       TestElemOutputPort(const std::string& name, Node *node, TypeCode* type);
41       TestElemOutputPort(const TestElemOutputPort& other, Node *newHelder);
42       void put(const void *data) throw(ConversionException);
43       OutputPort *clone(Node *newHelder) const;
44     };
45     
46     class RuntimeForEngineTest : public Runtime
47     {
48     public:
49       static void setRuntime();
50       ElementaryNode* createNode(const std::string& implementation, const std::string& name) throw(Exception);
51       InputPort* createInputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
52       OutputPort* createOutputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type);
53       InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type) throw (ConversionException);
54     };
55   }
56 }
57
58 #endif