1 #include "RuntimeForEngineIntegrationTest.hxx"
2 #include "ComponentInstanceTest.hxx"
7 using namespace YACS::ENGINE;
9 void RuntimeForEngineIntegrationTest::setRuntime()
11 if (! Runtime::_singleton)
12 Runtime::_singleton = new RuntimeForEngineIntegrationTest;
15 ElementaryNode* RuntimeForEngineIntegrationTest::createNode(const string& implementation, const string& name) throw(Exception)
17 if (implementation == ToyNode::MY_IMPL_NAME)
18 return new ToyNode(name);
19 else if(implementation == LimitNode::MY_IMPL_NAME)
20 return new LimitNode(name);
21 string what="RuntimeForEngineIntegrationTest does not handle this implementation: " + implementation;
22 throw Exception(what);
25 InputPort* RuntimeForEngineIntegrationTest::createInputPort(const string& name, const string& impl, Node * node, TypeCode * type)
27 if(impl == ToyNode::MY_IMPL_NAME)
29 if(type->kind()!=Double)
30 throw Exception("Invalid type");
31 return new InputToyPort(name, node);
33 else if(impl == LimitNode::MY_IMPL_NAME)
34 throw Exception("InputPort creation not allowed for LimitNode");
36 msg << "Cannot create " << impl << " OutputPort" ;
37 throw Exception(msg.str());
40 OutputPort* RuntimeForEngineIntegrationTest::createOutputPort(const string& name, const string& impl, Node * node, TypeCode * type)
42 if(impl == ToyNode::MY_IMPL_NAME)
44 if(type->kind()!=Double && type->kind()!=Int)
45 throw Exception("Invalid type");
46 return new OutputToyPort(name, node, type);
48 else if(impl == LimitNode::MY_IMPL_NAME)
49 throw Exception("OutputPort creation not allowed for LimitNode");
51 msg << "Cannot create " << impl << " OutputPort" ;
52 throw Exception(msg.str());
55 InputPort* RuntimeForEngineIntegrationTest::adapt(InputPort* source, const string& impl,TypeCode * type) throw (ConversionException)
57 return new ProxyPort(source);
60 ComponentInstance* RuntimeForEngineIntegrationTest::createComponentInstance(const std::string& name, const std::string& kind)
62 if(kind==ToyNode1S::KIND)
63 return new ComponentInstanceTest1(name);
64 else if(kind==ToyNode2S::KIND)
65 return new ComponentInstanceTest2(name);
68 string msg("RuntimeForEngineIntegrationTest::createComponentInstance : Unable to crate component with kind \"");