Package rosmaster :: Module registrations :: Class Registrations

Class Registrations

source code

object --+
         |
        Registrations

All calls may result in access/modifications to node registrations dictionary, so be careful to guarantee appropriate thread-safeness.

Data structure for storing a set of registrations (e.g. publications, services). The underlying data storage is the same except for services, which have the constraint that only one registration may be active for a given key.

Instance Methods
 
__init__(self, type_)
ctor.
source code
 
__nonzero__(self)
Returns: True if there are no registrations
source code
 
iterkeys(self)
Iterate over registration keys
source code
 
get_service_api(self, service)
Lookup service API URI.
source code
[str]
get_apis(self, key)
Only valid if self.type != SERVICE.
source code
 
__contains__(self, key)
Emulate mapping type for has_key()
source code
[(str, str),]
__getitem__(self, key)
Returns: (caller_id, caller_api) for registered key, empty list if registration is not valid
source code
bool
has_key(self, key)
Returns: True if key is registered
source code
[str, [str]...]
get_state(self)
Returns: state in getSystemState()-friendly format [ [key, [callerId1...callerIdN]] ...
source code
 
register(self, key, caller_id, caller_api, service_api=None)
Add caller_id into the map as a provider of the specified service (key).
source code
 
unregister_all(self, caller_id)
Remove all registrations associated with caller_id
source code
code, msg, val
unregister(self, key, caller_id, caller_api, service_api=None)
Remove caller_id from the map as a provider of the specified service (key).
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  TOPIC_SUBSCRIPTIONS = 1
  TOPIC_PUBLICATIONS = 2
  SERVICE = 3
  PARAM_SUBSCRIPTIONS = 4
Properties

Inherited from object: __class__

Method Details

__init__(self, type_)
(Constructor)

source code 

ctor.

Parameters:
  • type_ (int) - one of [ TOPIC_SUBSCRIPTIONS, TOPIC_PUBLICATIONS, SERVICE, PARAM_SUBSCRIPTIONS ]
Overrides: object.__init__

__nonzero__(self)
(Boolean test operator)

source code 
Returns:
True if there are no registrations

iterkeys(self)

source code 

Iterate over registration keys

Returns:
iterator for registration keys

get_service_api(self, service)

source code 

Lookup service API URI. NOTE: this should only be valid if type==SERVICE as service Registrations instances are the only ones that track service API URIs.

Parameters:
  • service (str) - service name

get_apis(self, key)

source code 

Only valid if self.type != SERVICE.

Parameters:
  • key (str) - registration key (e.g. topic/service/param name)
Returns: [str]
caller_apis for registered key, empty list if registration is not valid

__getitem__(self, key)
(Indexing operator)

source code 
Parameters:
  • key (str) - registration key (e.g. topic/service/param name)
Returns: [(str, str),]
(caller_id, caller_api) for registered key, empty list if registration is not valid

has_key(self, key)

source code 
Parameters:
  • key (str) - registration key (e.g. topic/service/param name)
Returns: bool
True if key is registered

get_state(self)

source code 
Returns: [str, [str]...]
state in getSystemState()-friendly format [ [key, [callerId1...callerIdN]] ... ]

register(self, key, caller_id, caller_api, service_api=None)

source code 

Add caller_id into the map as a provider of the specified service (key). caller_id must not have been previously registered with a different caller_api.

Subroutine for managing provider map data structure (essentially a multimap).

Parameters:
  • key (str) - registration key (e.g. topic/service/param name)
  • caller_id (str) - caller_id of provider
  • caller_api (str) - API URI of provider
  • service_api (str) - (keyword) ROS service API URI if registering a service

unregister_all(self, caller_id)

source code 

Remove all registrations associated with caller_id

Parameters:
  • caller_id (str) - caller_id of provider

unregister(self, key, caller_id, caller_api, service_api=None)

source code 

Remove caller_id from the map as a provider of the specified service (key). Subroutine for managing provider map data structure, essentially a multimap

Parameters:
  • key (str) - registration key (e.g. topic/service/param name)
  • caller_id (str) - caller_id of provider
  • caller_api (str) - API URI of provider
  • service_api (str) - (keyword) ROS service API URI if registering a service
Returns: code, msg, val
for ease of master integration, directly returns unregister value for higher-level XMLRPC API. val is the number of APIs unregistered (0 or 1)