38 #ifndef ORO_NAMESERVER_HPP 39 #define ORO_NAMESERVER_HPP 70 template <
class _ValueType >
76 typedef std::map<NameType, ValueType>
Rep;
107 return ( objects.find( s ) != objects.end() );
119 for ( const_iterator i = objects.begin(); i != objects.end(); ++i )
121 if ( ( *i ).second == o )
138 const_iterator itc = objects.find( s );
139 if ( itc == objects.end() )
141 return( *itc ).second;
155 for ( const_iterator i = objects.begin(); i != objects.end(); ++i )
157 if ( ( *i ).second == s )
179 objects.insert(std::make_pair(name,obj));
192 iterator i(objects.begin());
199 for ( i = objects.begin();
203 if ( ( *i ).second == obj )
207 if ( i == objects.end() )
return;
223 iterator i( objects.find( name ) );
225 if ( i != objects.end() ) {
239 class value_iterator :
public bidirectional_iterator<ValueType, int>
253 return ( ( *i ).second );
284 return ( i == other.
i );
289 return ( i != other.
i );
294 return ( i -other.
i );
304 class name_iterator :
public bidirectional_iterator<NameType, int>
306 class
name_iterator :
public std::iterator< std::input_iterator_tag , NameType>
320 return ( ( *i ).first );
351 return ( i == other.
i );
356 return ( i != other.
i );
361 return ( i -other.
i );
368 name_iterator
getNameBegin() {
return name_iterator( objects.begin() ); }
373 name_iterator
getNameEnd() {
return name_iterator( objects.end() ); }
387 static NameType NoName;
395 #endif // NAMESERVER_HPP value_iterator & operator++()
value_iterator operator--(int)
name_iterator(iterator _i)
bool operator!=(value_iterator other)
~NameServer()
Destruct a nameserver.
bool operator==(value_iterator other)
A nameserver for Orocos Device classes.
An Iterator to iterate over the registered objects.
name_iterator & operator++()
bool registerObject(const ValueType obj, const NameType &name)
Register an object with a name.
bool isNameRegistered(const NameType &s) const
Determine if a given name is registered.
name_iterator operator--(int)
value_iterator(iterator _i)
An Iterator to iterate over the registered names.
NameServer< _ValueType >::iterator i
name_iterator getNameEnd()
Get an iterator to the end of the names list.
bool operator==(name_iterator other)
value_iterator & operator--()
value_iterator getValueBegin()
Get an iterator to the beginning of the objects list.
NameServer< _ValueType >::iterator i
Rep::const_iterator const_iterator
The const_iterator for iterating over the internal representation.
Rep::iterator iterator
The iterator for iterating over the internal representation.
ValueType getObject(const NameType &s) const
Get the object registered for a name.
std::map< NameType, ValueType > Rep
const NameType & getName(const ValueType s) const
Get the name registered for a object.
bool isObjectRegistered(const ValueType o) const
Determine if a given object is registered.
int operator-(value_iterator other)
void unregisterObject(const ValueType obj)
Remove an object from the nameserver registrations.
bool operator!=(name_iterator other)
name_iterator getNameBegin()
Get an iterator to the beginning of the names list.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
value_iterator getValueEnd()
Get an iterator to the end of the objects list.
name_iterator operator++(int)
NameServer()
Construct an empty NameServer.
void unregisterName(const NameType &name)
Remove a name from the nameserver registrations.
name_iterator & operator--()
value_iterator operator++(int)