10 #define BOOST_TEST_MODULE factory 12 #if BOOST_VERSION >= 105900 13 #include <boost/test/tools/output_test_stream.hpp> 15 #include <boost/test/output_test_stream.hpp> 17 #include <boost/test/unit_test.hpp> 19 using boost::test_tools::output_test_stream;
46 BOOST_ERROR(
"Should never happen.");
48 BOOST_CHECK_EQUAL(exception.
getCode(),
54 BOOST_ERROR(
"Should never happen.");
56 BOOST_CHECK_EQUAL(exception.
getCode(),
66 BOOST_ERROR(
"Should never happen.");
68 BOOST_CHECK_EQUAL(exception.
getCode(),
75 BOOST_ERROR(
"Should never happen.");
77 BOOST_CHECK_EQUAL(exception.
getCode(),
87 boost::shared_ptr<dynamicgraph::Entity> entity(
91 boost::shared_ptr<dynamicgraph::Entity> entity2(
95 boost::shared_ptr<dynamicgraph::Entity> entity3(
102 BOOST_ERROR(
"Should never happen.");
104 BOOST_CHECK_EQUAL(exception.
getCode(),
113 BOOST_CHECK_EQUAL(exception.
getCode(),
void registerEntity(const std::string &entname, EntityConstructor_ptr ent)
Add a new entity to the factory.
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
bool existEntity(const std::string &name) const
Check if an Entity associated with a particular name has already been registered. ...
void deregisterEntity(const std::string &entname)
Delete an entity from the factory.
static const std::string CLASS_NAME
BOOST_AUTO_TEST_CASE(constructor)
virtual const std::string & getClassName() const
int getCode() const
Access to the error code.
CustomEntity(const std::string &n)
Entity(const std::string &name)
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.
static void destroy()
Destroy the unique instance of the class.
dynamicgraph::Entity * makeEntity(const std::string &objectName)