Go to the documentation of this file.
14 #define BOOST_TEST_MODULE pool
16 #if BOOST_VERSION >= 105900
17 #include <boost/test/tools/output_test_stream.hpp>
19 #include <boost/test/output_test_stream.hpp>
21 #include <boost/test/unit_test.hpp>
23 using boost::test_tools::output_test_stream;
34 m_sigdSIN(NULL,
"MyEntity(" +
name +
")::input(double)::in_double"),
37 "MyEntity(" +
name +
")::input(double)::out_double") {
41 virtual void display(std::ostream &os)
const {
42 os <<
"Hello! My name is " <<
getName() <<
" !" << std::endl;
48 const double &aDouble =
m_sigdSIN(inTime);
66 "MyEntity",
"MyEntityInst");
68 bool res2 = (entity2 == entity);
85 output_test_stream output;
88 BOOST_CHECK(output.is_equal(
"Hello! My name is MyEntityInst !\n"));
103 bool testExistence = anEntityMap.find(
"MyEntityInst") == anEntityMap.end();
104 BOOST_CHECK(!testExistence);
110 BOOST_CHECK(testExistence);
115 output.is_equal(
"MyEntityInst.in_double\nMyEntityInst.out_double\n"
116 "print\nsignals\nsignalDep\n"));
120 std::fstream the_debug_file;
121 the_debug_file.open(
"output.dot");
122 std::ostringstream oss_output_wgph;
123 oss_output_wgph << the_debug_file.rdbuf();
124 the_debug_file.close();
127 std::string str_to_test =
128 "/* This graph has been automatically generated.\n"
129 " 2019 Month: 2 Day: 28 Time: 11:28 */\n"
130 "digraph \"output\" { \t graph [ label=\"output\" "
131 "bgcolor = white rankdir=LR ]\n"
132 "\t node [ fontcolor = black, color = black,fillcolor = gold1,"
133 " style=filled, shape=box ] ; \n"
134 "\tsubgraph cluster_Entities { \n"
136 "\"MyEntityInst\" [ label = \"MyEntityInst\" ,\n"
137 " fontcolor = black, color = black, fillcolor=cyan, style=filled,"
142 std::string s_output_wgph = oss_output_wgph.str();
143 std::string s_crmk =
"*/";
145 std::size_t find_s_output_wgph = s_output_wgph.find(s_crmk);
146 std::string sub_s_output_wgph =
147 s_output_wgph.substr(find_s_output_wgph, s_output_wgph.length());
148 std::size_t find_str_to_test = str_to_test.find(s_crmk);
149 std::string sub_str_to_test =
150 str_to_test.substr(find_str_to_test, str_to_test.length());
152 bool two_sub_string_identical;
153 two_sub_string_identical = sub_str_to_test == sub_s_output_wgph;
154 std::cout << sub_str_to_test << std::endl;
155 std::cout << sub_s_output_wgph << std::endl;
156 std::cout << sub_str_to_test.compare(sub_s_output_wgph) << std::endl;
157 BOOST_CHECK(two_sub_string_identical);
160 std::istringstream an_iss(
"MyEntityInst.in_double");
165 std::string aSignalName = aSignal.
getName();
167 aSignalName ==
"MyEntity(MyEntityInst)::input(double)::in_double";
168 BOOST_CHECK(testExistence);
171 an_iss.str(
"MyEntityInst.in2double");
187 BOOST_CHECK(!testExistence);
190 std::string name_entity(
"MyEntityInst2");
SignalBase< sigtime_t > & getSignal(std::istringstream &sigpath)
Get a signal by name.
virtual const std::string & getClassName() const
dynamicgraph::SignalPtr< double, sigtime_t > m_sigdSIN
void deregisterEntity(const std::string &entname)
Unregister an entity.
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
void writeGraph(const std::string &aFileName)
This method write a graph description on the file named FileName.
dynamicgraph::sigtime_t sigtime_t
double & update(double &res, const sigtime_t &inTime)
Entity & getEntity(const std::string &name)
Get an entity.
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(MyEntity, "MyEntity")
const std::string & getName() const
void clearPlugin(const std::string &name)
Disallocate an entity.
const std::string & getName() const
int getCode() const
Access to the error code.
virtual void display(std::ostream &os) const
Display information on the entity inside the output stream os.
static const std::string CLASS_NAME
virtual void display(std::ostream &os) const
Display information on the entity inside the output stream os.
Entity(const std::string &name)
const Entities & getEntityMap() const
Const access to entity map.
void deregisterEntity(const std::string &entname)
Delete an entity from the factory.
dynamicgraph::SignalTimeDependent< double, sigtime_t > m_sigdTimeDepSOUT
BOOST_AUTO_TEST_CASE(pool_display)
bool existEntity(const std::string &name)
Test if the entity exists.
void writeCompletionList(std::ostream &os)
std::map< std::string, Entity * > Entities
Sorted set of entities with unique key (name).
static PoolStorage * getInstance()
Get unique instance of the class.
static void destroy()
Destroy the unique instance of the class.
MyEntity(const std::string &name)
dynamicgraph::sigtime_t sigtime_t
void signalRegistration(const SignalArray< sigtime_t > &signals)
Entity * newEntity(const std::string &classname, const std::string &objname) const
Instantiate (and allocate) an entity.
static FactoryStorage * getInstance()
Get pointer to unique object of the class.
dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38