_var+=2;
_s1.post();
_s2.post();
+ return 0;
}
void *BasesTest::th1_2(void *st)
_s2.wait();
_glob<< myName << _var;
_s2.post();
+ return 0;
}
void *BasesTest::th1_3(void *st)
char myName=*((char *) st);
_glob<< myName << _var++;
_s1.post();
+ return 0;
}
void *BasesTest::th2_1(void *)
_m.unlock();
Thread::sleep(100000);
}
+ return 0;
}
void *BasesTest::myFunc(void *n)
DEBTRACE("thread " << id << " frees " << i << " resources");
free_resources(id, i);
}
-}
+ return 0;
+ }
void BasesTest::get_resources(int id, int amount)
{
}
for (i=0; i<THREAD_NUM; i++)
- {
+ {
ths[i] = new Thread(myFunc, &id[i]);
CPPUNIT_ASSERT(count_resources() == BasesTest::MAX_RESOURCE);
}
template<bool direction>
unsigned Bloc::appendIfAlreadyFound(std::list< std::vector<Node *> >& res, const std::vector<Node *>& startRes, Node *node, std::map<Node *, std::set<Node *> >& fastFinder)
{
- std::map<Node *, std::set<Node *> >::const_iterator iter=fastFinder.find(node);
+ std::map<Node *, std::set<Node *> >::iterator iter=fastFinder.find(node);
if(iter==fastFinder.end())
return 0;
unsigned ret=0;
std::vector<std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator > > li;
- li.push_back(std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator>(((*iter).second).begin(),((*iter).second).end()));
+ std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> ipr(((*iter).second).begin(),((*iter).second).end());
+ li.push_back(ipr);
std::vector<Node *> work(startRes);
std::list< std::vector<Node *> >::iterator where=res.end(); where--;
std::list< std::vector<Node *> >::iterator updates=where;
}
else
{
- const std::set<Node *>& s=fastFinder[*(li.back().first)];
- li.push_back(std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator>(s.begin(),s.end()));
+ std::set<Node *>& s=fastFinder[*(li.back().first)];
+ std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> pr(s.begin(),s.end());
+ li.push_back(pr);
}
}
else
_ptr->decrRef();
_ptr=other._ptr;
_ptr->incrRef();
+ return *this;
}
template<class T>
YACSBases
)
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(
+ ${OMNIORB_DEFINITIONS}
+)
+
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
# --- sources ---
SET(PluginOptEvTest1_SOURCES
return _alreadyStarted;
}
-void ContainerTest::start(const ComponentInstance *inst) throw(Exception)
+void ContainerTest::start(const ComponentInstance *inst) throw(YACS::Exception)
{
if(_alreadyStarted)
throw Exception("ContainerTest already started !!!!");
return new ContainerTest;
}
-void ContainerTest::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception)
+void ContainerTest::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
{
if(inst->getKind()!=SUPPORTED_COMP_KIND)
throw Exception("ContainerTest not compatible with this type of instance.");
return _alreadyStarted;
}
-void ContainerTest2::start(const ComponentInstance *inst) throw(Exception)
+void ContainerTest2::start(const ComponentInstance *inst) throw(YACS::Exception)
{
if(_alreadyStarted)
throw Exception("ContainerTest already started !!!!");
_counter=0;
}
-void ContainerTest2::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception)
+void ContainerTest2::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
{
if(inst->getKind()!=SUPPORTED_COMP_KIND)
throw Exception("ContainerTest not compatible with this type of instance.");
#include "RuntimeForEngineIntegrationTest.hxx"
#include "ComponentInstanceTest.hxx"
+#include "Exception.hxx"
#include "ToyNode.hxx"
#include "TypeCode.hxx"
#include <sstream>
+#include <string.h>
+
-using namespace std;
using namespace YACS::ENGINE;
void RuntimeForEngineIntegrationTest::setRuntime()
Runtime::_singleton = new RuntimeForEngineIntegrationTest;
}
-ElementaryNode* RuntimeForEngineIntegrationTest::createNode(const string& implementation, const string& name) throw(Exception)
+ElementaryNode* RuntimeForEngineIntegrationTest::createNode(const std::string& implementation, const std::string& name) throw (YACS::Exception)
{
if (implementation == ToyNode::MY_IMPL_NAME)
return new ToyNode(name);
else if(implementation == LimitNode::MY_IMPL_NAME)
return new LimitNode(name);
- string what="RuntimeForEngineIntegrationTest does not handle this implementation: " + implementation;
- throw Exception(what);
+ std::string what="RuntimeForEngineIntegrationTest does not handle this implementation: " + implementation;
+ throw YACS::Exception(what);
}
-InputPort* RuntimeForEngineIntegrationTest::createInputPort(const string& name, const string& impl, Node * node, TypeCode * type)
+InputPort* RuntimeForEngineIntegrationTest::createInputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type)
{
if(impl == ToyNode::MY_IMPL_NAME)
{
}
else if(impl == LimitNode::MY_IMPL_NAME)
throw Exception("InputPort creation not allowed for LimitNode");
- ostringstream msg;
+ std::ostringstream msg;
msg << "Cannot create " << impl << " OutputPort" ;
- throw Exception(msg.str());
+ throw YACS::Exception(msg.str());
}
-OutputPort* RuntimeForEngineIntegrationTest::createOutputPort(const string& name, const string& impl, Node * node, TypeCode * type)
+OutputPort* RuntimeForEngineIntegrationTest::createOutputPort(const std::string& name, const std::string& impl, Node * node, TypeCode * type)
{
if(impl == ToyNode::MY_IMPL_NAME)
{
}
else if(impl == LimitNode::MY_IMPL_NAME)
throw Exception("OutputPort creation not allowed for LimitNode");
- stringstream msg;
+ std::stringstream msg;
msg << "Cannot create " << impl << " OutputPort" ;
throw Exception(msg.str());
}
-InputPort* RuntimeForEngineIntegrationTest::adapt(InputPort* source, const string& impl,TypeCode * type,bool init) throw (ConversionException)
+InputPort* RuntimeForEngineIntegrationTest::adapt(InputPort* source, const std::string& impl,TypeCode * type,bool init) throw (ConversionException)
{
return new ProxyPort(source);
}
return new ComponentInstanceTest2(name);
else
{
- string msg("RuntimeForEngineIntegrationTest::createComponentInstance : Unable to crate component with kind \"");
+ std::string msg("RuntimeForEngineIntegrationTest::createComponentInstance : Unable to crate component with kind \"");
msg+=kind; msg+="\"";
throw Exception(msg);
}
return new TestElemInputPort(*this,newHelder);
}
-void *TestElemInputPort::get() const throw(Exception)
+void *TestElemInputPort::get() const throw(YACS::Exception)
{
stringstream msg;
msg << "Not implemented (" << __FILE__ << ":" << __LINE__ << ")";
Runtime::_singleton = new RuntimeForEngineTest;
}
-ElementaryNode* RuntimeForEngineTest::createNode(const string& implementation, const string& name) throw(Exception)
+ElementaryNode* RuntimeForEngineTest::createNode(const string& implementation, const string& name) throw(YACS::Exception)
{
return new TestElemNode(name);
}
return _initData!=0;
}
-void *InputToyPort::get() const throw(Exception)
+void *InputToyPort::get() const throw(YACS::Exception)
{
return (void *)_data;
}
return ElementaryNode::getNumberOfInputPorts()+1;
}
-OutputPort *ToyNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_FOR_NB)
return (OutputPort *)&_nbOfInputsPort;
return ret;
}
-InputPort *SeqToyNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *SeqToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_NBOFELTS_INSEQ_INPRT)
return (InputPort *)&_inIntValue;
return ret;
}
-OutputPort *SeqToyNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *SeqToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_SEQ_OUTPRT)
return (OutputPort *)&_seqOut;
return ret;
}
-InputPort *Seq2ToyNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *Seq2ToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_SEQ_INPRT1)
return (InputPort *)&_inValue1;
return ret;
}
-OutputPort *Seq2ToyNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *Seq2ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_SEQ_OUTPRT)
return (OutputPort *)&_seqOut;
return ret;
}
-InputPort *Seq3ToyNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *Seq3ToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_SEQ_INPRT1)
return (InputPort *)&_inValue1;
return ret;
}
-OutputPort *Seq3ToyNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *Seq3ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_SEQ_OUTPRT)
return (OutputPort *)&_seqOut;
return _initData!=0;
}
-void *InputLimitPort::get() const throw(Exception)
+void *InputLimitPort::get() const throw(YACS::Exception)
{
if(!_data)
{
return ret;
}
-InputPort *LimitNode::getInputPort(const std::string& name) const throw(Exception)
+InputPort *LimitNode::getInputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_FOR_SWPORT)
return (InputPort *)&_entry;
return ElementaryNode::getInputPort(name);
}
-OutputPort *LimitNode::getOutputPort(const std::string& name) const throw(Exception)
+OutputPort *LimitNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
{
if(name==NAME_FOR_SWPORT)
return (OutputPort *)&_switchPort;
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
exe.RunW(graph);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() || 7==(int)opt->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
exe.RunW(graph);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() || 7==(int)opt->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
Bloc *clone=(Bloc *)graph->clone(0);
delete graph;
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
exe.RunW(clone);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() || 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
exe.RunW(clone);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() || 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
delete clone;
}
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
exe.RunW(graph);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() || 7==(int)opt->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
exe.RunW(graph);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)o2_1)->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() or 7==(int)opt->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)opt->getNumberOfEltsConsumed() || 7==(int)opt->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((DynParaLoop *)(opt))->getNumberOfBranchesCreatedDyn());
Bloc *clone=(Bloc *)graph->clone(0);
delete graph;
CPPUNIT_ASSERT(!info.areWarningsOrErrors());
exe.RunW(clone);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() || 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
exe.RunW(clone);
CPPUNIT_ASSERT_DOUBLES_EQUAL(45.6,((OutputToyPort*)(clone->getOutPort("T2.o1")))->get()->getDoubleValue(),DBL_PRECISION_COMPARE );
- CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() or 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
+ CPPUNIT_ASSERT(8==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed() || 7==(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfEltsConsumed());
CPPUNIT_ASSERT_EQUAL(2,(int)((OptimizerLoop *)(clone->getChildByName("myOptWthAlgSync")))->getNumberOfBranchesCreatedDyn());
delete clone;
}
template<class T>
void EngineIntegrationTest::checkSetsEqual(const std::set<T>& setToTest1, const std::set<T>& setToTest2)
{
- typename std::set<T>::iterator iter1=setToTest1.begin();
- typename std::set<T>::iterator iter2=setToTest2.begin();
+ typename std::set<T>::const_iterator iter1=setToTest1.begin();
+ typename std::set<T>::const_iterator iter2=setToTest2.begin();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sets can't be equal : size different", (int)setToTest1.size(), (int)setToTest2.size());
for(;iter1!=setToTest1.end();iter1++,iter2++)
CPPUNIT_ASSERT_MESSAGE("Sets can't be equal : value different", *iter1==*iter2);
template<class T>
void EngineIntegrationTest::checkSetsNotEqual(const std::set<T *>& setToTest1, const std::set<T *>&setToTest2)
{
- typename std::set<T *>::iterator iter1=setToTest1.begin();
+ typename std::set<T *>::const_iterator iter1=setToTest1.begin();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sets can't be equal : size different", (int)setToTest1.size(), (int)setToTest2.size());
for(;iter1!=setToTest1.end();iter1++)
CPPUNIT_ASSERT_MESSAGE("Elements is in set : not expected.",setToTest2.find(*iter1)==setToTest2.end());
#include <string>
#include "ComponentInstance.hxx"
+#include "YACSRuntimeSALOMEExport.hxx"
namespace YACS
{
typedef void (*TerminateFunction)(void **);
typedef void (*PingFunction) ();
- class CppComponent : public ComponentInstance {
+ class YACSRUNTIMESALOME_EXPORT CppComponent : public ComponentInstance {
public:
CppComponent(const std::string & name);
#define _CPPNODE_HXX_
#include "ServiceNode.hxx"
+#include "YACSRuntimeSALOMEExport.hxx"
namespace YACS
{
* \ingroup Nodes
*
*/
- class CppNode : public YACS::ENGINE::ServiceNode
+ class YACSRUNTIMESALOME_EXPORT CppNode : public YACS::ENGINE::ServiceNode
{
protected:
Node *simpleClone(ComposedNode *father, bool editionOnly) const;
# additional preprocessor / compiler flags
ADD_DEFINITIONS(
${PTHREAD_DEFINITIONS}
+ ${OMNIORB_DEFINITIONS}
-DUSE_CPPUNIT
)
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
+
# --- sources ---
# idl files
${CMAKE_CURRENT_BINARY_DIR}
)
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(
+ ${OMNIORB_DEFINITIONS}
+)
+
+IF(WIN32)
+ ADD_DEFINITIONS(-DNOGDI)
+ENDIF(WIN32)
+
+
# --- sources ---
# idl files