A nameserver for Orocos Device classes. More...
#include <NameServer.hpp>
Classes | |
class | name_iterator |
An Iterator to iterate over the registered names. More... | |
class | value_iterator |
An Iterator to iterate over the registered objects. More... | |
Public Types | |
typedef Rep::const_iterator | const_iterator |
typedef Rep::iterator | iterator |
typedef std::string | NameType |
typedef std::map< NameType, ValueType > | Rep |
typedef _ValueType | ValueType |
Public Member Functions | |
const NameType & | getName (const ValueType s) const |
Get the name registered for a object. More... | |
name_iterator | getNameBegin () |
Get an iterator to the beginning of the names list. More... | |
name_iterator | getNameEnd () |
Get an iterator to the end of the names list. More... | |
ValueType | getObject (const NameType &s) const |
Get the object registered for a name. More... | |
value_iterator | getValueBegin () |
Get an iterator to the beginning of the objects list. More... | |
value_iterator | getValueEnd () |
Get an iterator to the end of the objects list. More... | |
bool | isNameRegistered (const NameType &s) const |
Determine if a given name is registered. More... | |
bool | isObjectRegistered (const ValueType o) const |
Determine if a given object is registered. More... | |
NameServer () | |
Construct an empty NameServer. More... | |
bool | registerObject (const ValueType obj, const NameType &name) |
Register an object with a name. If an object with such a name already exists, the present one will not be overwritten, and this call is a no-op. More... | |
void | unregisterName (const NameType &name) |
Remove a name from the nameserver registrations. More... | |
void | unregisterObject (const ValueType obj) |
Remove an object from the nameserver registrations. More... | |
~NameServer () | |
Destruct a nameserver. More... | |
Private Attributes | |
Rep | objects |
Static Private Attributes | |
static NameType | NoName |
A nameserver for Orocos Device classes.
This class allows to globally set up device driver objects and find them back in the same process by querying this class. Every Orocos device driver type has a Device::nameserver type which allows retrieval of the object:
// At application startup code: Device* init_device = new Device("device_name"); // ... // In other places: Device* myDevice = Device::nameserver.getObject("device_name");
In case two objects are registered with the same name, the first one is kept and the second one rejected.
_ValueType | The type of objects you want to have nameserved( usually a pointer type ). |
Definition at line 71 of file NameServer.hpp.
typedef Rep::const_iterator RTT::dev::NameServer< _ValueType >::const_iterator |
The const_iterator for iterating over the internal representation
Definition at line 84 of file NameServer.hpp.
typedef Rep::iterator RTT::dev::NameServer< _ValueType >::iterator |
The iterator for iterating over the internal representation
Definition at line 80 of file NameServer.hpp.
typedef std::string RTT::dev::NameServer< _ValueType >::NameType |
Definition at line 75 of file NameServer.hpp.
typedef std::map<NameType, ValueType> RTT::dev::NameServer< _ValueType >::Rep |
Definition at line 76 of file NameServer.hpp.
typedef _ValueType RTT::dev::NameServer< _ValueType >::ValueType |
Definition at line 74 of file NameServer.hpp.
|
inline |
Construct an empty NameServer.
Definition at line 89 of file NameServer.hpp.
|
inline |
Destruct a nameserver.
Definition at line 95 of file NameServer.hpp.
|
inline |
Get the name registered for a object.
s | the object of the name you need |
Definition at line 153 of file NameServer.hpp.
|
inline |
Get an iterator to the beginning of the names list.
Definition at line 368 of file NameServer.hpp.
|
inline |
Get an iterator to the end of the names list.
Definition at line 373 of file NameServer.hpp.
|
inline |
Get the object registered for a name.
s | the name of the object you need |
Definition at line 136 of file NameServer.hpp.
|
inline |
Get an iterator to the beginning of the objects list.
Definition at line 378 of file NameServer.hpp.
|
inline |
Get an iterator to the end of the objects list.
Definition at line 383 of file NameServer.hpp.
|
inline |
Determine if a given name is registered.
s | the name to check |
Definition at line 105 of file NameServer.hpp.
|
inline |
Determine if a given object is registered.
o | the object to check |
Definition at line 117 of file NameServer.hpp.
|
inline |
Register an object with a name. If an object with such a name already exists, the present one will not be overwritten, and this call is a no-op.
obj | The instance you wish to register with a name |
name | The name of the object |
Definition at line 172 of file NameServer.hpp.
|
inline |
Remove a name from the nameserver registrations.
name | the name of the object you want remove |
Definition at line 221 of file NameServer.hpp.
|
inline |
Remove an object from the nameserver registrations.
obj | the object you want removed |
Definition at line 190 of file NameServer.hpp.
|
staticprivate |
Definition at line 387 of file NameServer.hpp.
|
private |
Definition at line 386 of file NameServer.hpp.