Go to the documentation of this file.
21 #define BOOST_TEST_MODULE entity
23 #if BOOST_VERSION >= 105900
24 #include <boost/test/tools/output_test_stream.hpp>
26 #include <boost/test/output_test_stream.hpp>
28 #include <boost/test/unit_test.hpp>
30 using boost::test_tools::output_test_stream;
42 m_sigdSIN(NULL,
"CustomEntity(" +
name +
")::input(double)::in_double"),
44 "CustomEntity(" +
name +
")::input(double)::in_double"),
47 "CustomEntity(" +
name +
")::input(double)::out_double"),
58 BOOST_CHECK_EQUAL(aef.
getCode(),
69 const double &aDouble =
m_sigdSIN(inTime);
87 "CustomEntity",
"my-entity");
88 BOOST_CHECK_EQUAL(entity.
getName(),
"my-entity");
94 dgc::DirectGetter<dg::CustomEntity, double> a_direct_getter(
98 dgc::DirectSetter<dg::CustomEntity, double> a_direct_setter(
102 dgc::Value aValue(2.0);
103 std::vector<dgc::Value> values;
104 values.push_back(aValue);
105 a_direct_setter.setParameterValues(values);
106 a_direct_setter.execute();
107 a_direct_getter.execute();
109 output_test_stream output;
123 BOOST_ERROR(
"Should never happen.");
125 BOOST_CHECK_EQUAL(exception.
getCode(),
133 BOOST_ERROR(
"Should never happen.");
135 BOOST_CHECK_EQUAL(exception.
getCode(),
143 std::string signame(
"CustomEntity(my-entity)::input(double)::in_double");
144 customEntity->Entity::hasSignal(signame);
145 output_test_stream output;
146 customEntity->Entity::displaySignalList(output);
148 output << customEntity;
152 customEntity->rmValidSignal();
153 BOOST_ERROR(
"Should never happen.");
155 BOOST_CHECK_EQUAL(exception.
getCode(),
164 output_test_stream output;
167 BOOST_CHECK(output.is_equal(
"--- <my-entity> signal list: \n"));
174 output_test_stream output;
177 BOOST_CHECK(output.is_equal(
"CustomEntity: my-entity"));
184 BOOST_CHECK_EQUAL(entity.
getCommandList(),
"print\nsignals\nsignalDep");
191 output_test_stream output;
194 BOOST_CHECK(output.is_equal(
""));
201 output_test_stream output;
204 BOOST_CHECK(output.is_equal(
"print\nsignals\nsignalDep\n"));
209 of.open(
"/tmp/dg-LOGS.txt", std::ofstream::out | std::ofstream::app);
215 output_test_stream output;
217 for (
unsigned int i = 0; i < 4; i++) {
218 for (
unsigned int j = 0; j < 2000; j++) {
223 output <<
"Mismatch output";
225 #define __FILELINE__ __FILE__ BOOST_PP_STRINGIZE(__LINE__)
234 <<
" WARNING" <<
'\n';
242 BOOST_CHECK(output.is_equal(
""));
252 BOOST_CHECK_EQUAL(entity.
test(),
dynamicgraph::SignalPtr< double, sigtime_t > m_sigdSIN2
virtual const std::string & getClassName() const
dynamicgraph::SignalTimeDependent< double, sigtime_t > m_sigdTimeDepSOUT
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
dynamicgraph::sigtime_t sigtime_t
virtual std::ostream & writeGraph(std::ostream &os) const
This method is used to write down in os the edges of the graph by calling the signals writeGraph meth...
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CustomEntity, "CustomEntity")
SignalMap getSignalMap() const
Provides a map of all the signals.
std::ostream & displaySignalList(std::ostream &os) const
Display the list of signals of this entity in output stream os.
Entity & getEntity(const std::string &name)
Get an entity.
virtual std::string getDocString() const
Returns the Entity documentation.
CustomEntity(const std::string &n)
std::map< std::string, SignalBase< sigtime_t > * > SignalMap
const std::string & getName() const
dynamicgraph::SignalPtr< double, sigtime_t > m_sigdSIN
virtual const std::string & getClassName() 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.
virtual SignalBase< sigtime_t > * test()
std::string docDirectSetter(const std::string &name, const std::string &type)
Entity(const std::string &name)
double & update(double &res, const sigtime_t &inTime)
const std::string & getCommandList() const
static const std::string CLASS_NAME
void entityDeregistration()
std::string docDirectGetter(const std::string &name, const std::string &type)
virtual std::ostream & writeCompletionList(std::ostream &os) const
This method is used write in the output stream os the signals names and the commands of the entity.
static PoolStorage * getInstance()
Get unique instance of the class.
SignalBase< sigtime_t > & getSignal(const std::string &signalName)
Provides a reference to the signal named signalName.
#define dgADD_OSTREAM_TO_RTLOG(ostr)
virtual void test2(SignalBase< sigtime_t > *)
void signalDeregistration(const std::string &name)
void signalRegistration(const SignalArray< sigtime_t > &signals)
BOOST_AUTO_TEST_CASE(constructor)
Entity * newEntity(const std::string &classname, const std::string &objname) const
Instantiate (and allocate) an entity.
void setLoggerVerbosityLevel(LoggerVerbosity lv)
Specify the verbosity level of the logger.
static FactoryStorage * getInstance()
Get pointer to unique object of the class.
LoggerVerbosity getLoggerVerbosityLevel()
Get the logger's verbosity level.
dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38