Wallaroo
0.8
|
#include <catalog.h>
Public Member Functions | |
Catalog () | |
detail::PartShell | operator[] (const std::string &id) const |
void | Add (const std::string &id, const cxx0x::shared_ptr< Part > &dev) |
void | Remove (const std::string &id) |
void | Clear () |
std::size_t | Size () const |
template<class P1 , class P2 > | |
detail::PartShell | Create (const std::string &id, const std::string &className, const P1 &p1, const P2 &p2) |
template<class P > | |
detail::PartShell | Create (const std::string &id, const std::string &className, const P &p) |
detail::PartShell | Create (const std::string &id, const std::string &className) |
bool | IsWiringOk () const |
void | CheckWiring () const |
void | Init () |
Friends | |
class | Context |
class | UseAsExpression |
class | SetExpression |
UseExpression | use (const std::string &destClass) |
bool | IsWiringOk () |
void | CheckWiring () |
Catalog of parts available for the application.
It can create the instances from the name of a class previously registered with one of the macros WALLAROO_REGISTER(C), WALLAROO_DYNLIB_REGISTER(C).
Alternatively, you can add an instance, provided that its class derives from wallaroo::Part.
Each item in the catalog is identified by a id
, with which you can perform a lookup.
|
inline |
Build an empty catalog.
|
inline |
Add an element to the catalog
id | The name of the element to add |
dev | The element to add (its class must derive from wallaroo::Part) |
DuplicatedElement | If a part with the name id is already in the catalog |
|
inline |
Check if the wiring of the objects inside the container is correct according to the multiplicity declared in the Collaborator definition.
WiringError | If the wiring does not match with the multiplicity declared. |
|
inline |
Remove all elements of the catalog
|
inline |
Instantiate a class having a 2 parameters constructor and add it to the catalog
id | The name of the element to create and add |
className | The name of the class to instantiate (must derive from wallaroo::Part) |
p1 | The first parameter of the class constructor |
p2 | The second parameter of the class constructor |
DuplicatedElement | If an element with the name id is already in the catalog |
ElementNotFound | If className class has not been registered |
|
inline |
Instantiate a class having a 1 parameters constructor and add it to the catalog
id | The name of the element to create and add |
className | The name of the class to instantiate (must derive from wallaroo::Part) |
p | The parameter of the class constructor |
DuplicatedElement | If an element with the name id is already in the catalog |
ElementNotFound | If className class has not been registered |
|
inline |
Instantiate a class having a default constructor and add it to the catalog
id | The name of the element to create and add |
className | The name of the class to instantiate (must derive from wallaroo::Part) |
DuplicatedElement | If an element with the name id is already in the catalog |
ElementNotFound | If className class has not been registered |
|
inline |
This method calls Part::Init on every Part contained. You can call it in the setup phase of your application to perform the initialization required by each part before the run. Ideally you should call it after wiring and attributes setting, so that your objects already have dependencies and the right attribute values. This method rethrows every exception thrown by each Part::Init.
|
inline |
Check if the wiring of the objects inside the container is correct according to the multiplicity declared in the Collaborator definition.
|
inline |
Look for the element id
in the catalog. It returns a class that provides conversion operator so that you can write eg:
id | The name of the element |
ElementNotFound | If an element with key id cannot be found in the catalog. |
|
inline |
Remove an element from the catalog
id | The name of the element to remove |
ElementNotFound | If an element with key id cannot be found in the catalog. |
|
inline |
Returns the number of the elements contained in the catalog.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
This function provides the "use" part in the syntax use
( "part1" ).as( "collaborator" ).of( "part2" )
CatalogNotSpecified | if the current catalog has not been selected including this function in a wallaroo_within section |
|
friend |