MIRA
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
VisualizationTextBasic< T > Class Template Referenceabstract

#include <visualization/VisualizationTextBasic.h>

Inheritance diagram for VisualizationTextBasic< T >:
Inheritance graph
[legend]

Public Types

enum  Flags {
  NORMAL = 0x0000, ANONYMOUS = 0x0001, HIDDEN = 0x0002, INVISIBLE_PUBLISHER_SUBSCRIBER = 0x0004,
  INTERNAL = 0x000A, INDEPENDENT_SUBSCRIBER_THREAD = 0x0010, INDEPENDENT_RPC_THREAD = 0x0020, NO_MAIN_THREAD = 0x0040
}
 Flags for creating an authority. More...
 
typedef std::multimap< std::string, std::string > ChannelNameMapping
 
typedef std::map< std::string, StatusChannelStatusMap
 
typedef std::map< std::string, StatusStatusMap
 

Public Member Functions

 VisualizationTextBasic (const std::string &channelName)
 
virtual ~VisualizationTextBasic ()
 
template<typename Reflector >
void reflect (Reflector &r)
 
virtual void setupScene (IVisualizationTextSite *site)
 Must be implemented in derived classes. More...
 
virtual void setSize (const Size2i &size)
 
virtual Size2i getSize () const
 
virtual void setupScene (IVisualizationTextItem *item)
 
virtual DataConnection getDataConnection ()
 Returns information about the direct data connection for this visualization. More...
 
virtual void init (IVisualizationSite *site)
 Is called by the visualization view when the visualization is attached. More...
 
virtual IVisualizationTextSitegetSite ()
 Returns a pointer to the IVisualizationTextSite interface that was set in the init() method. More...
 
void setPrecision (uint precision)
 Set precision for displaying floating point numbers. More...
 
virtual void processUpdate (Duration dt)
 Is called regularly by the VisualizationView to update the visualization. More...
 
bool isEnabled () const
 Returns true, if this visualization is enabled and visible. More...
 
virtual void setEnabled (bool enabled)
 Changes the enabled-state and therefore the visibility of this visualization. More...
 
const std::string & getName () const
 Returns the associated name of this visualization. More...
 
void setName (const std::string &name)
 Sets the name of this visualization. More...
 
void setupDataConnectionChannel (const std::string &channelID)
 Sets up the data connection channel property (if any) with the specified channel id. More...
 
virtual AuthoritygetAuthority ()
 Return the authority as reference. More...
 
Class const & getClass () const
 call the virtual internalGetClass(). More...
 
void enableSubscriberCallbacks (bool enable)
 Enables/disables subscriptions. More...
 
StatusManagergetStatusManager ()
 
StatusMap getStatusMap () const
 Gets the current status map containing all errors, warnings and bootup messages. More...
 
void setHeartbeatInterval (const Duration &interval)
 Set the watchdog interval. More...
 
Duration getHeartbeatInterval () const
 Return the watchdog interval. More...
 
void heartbeat ()
 When called for the first time heartbeat usage will be enabled. More...
 
bool hasHeartbeatTimeout () const
 Returns true if heartbeat usage is enabled (by first call to heartbeat()) and last heartbeat was more than heartbeat interval time ago. More...
 
void bootup (const std::string &message, const std::string &trText="")
 Signal that the module is booting up. More...
 
void bootupFinished ()
 Signal that the module has finished booting up (There can still be errors but booting up is finished) More...
 
void recoverFinished ()
 Signal that the module has finished recovering (There can still be errors but recovering is finished) More...
 
void recover (const std::string &message, const std::string &trText="")
 Signal that the module is recovering. More...
 
void ok (const std::string &category="")
 Signal that a category contains no more errors. More...
 
bool warning (const std::string &category, const std::string &message, const std::string &trText="")
 Signal a warning in a category. More...
 
bool error (const std::string &category, const std::string &message, const std::string &trText="")
 Signal an error in a category. More...
 
bool setStatus (Status::StatusMode mode, const std::string &category, const std::string &message, const std::string &trText="")
 Set the status of a given category. More...
 
Status::StatusMode getStatus () const
 Get the status mode defined by the status of the watchdog (if used) and the bootup, error and warning methods. More...
 
Session Management and Runtime Control.

These methods allow to change the running state of the Authority.

Moreover, some methods allow to configure the behavior of the Authority and the used threading model.

void checkin (const ResourceName &fullname, AuthorityRuntimePtr runtime=AuthorityRuntimePtr())
 Checks in and therefore makes the authority valid by providing a namespace and a name that are given as fully qualified resource name. More...
 
void checkin (const ResourceName &ns, const std::string &name, AuthorityRuntimePtr runtime=AuthorityRuntimePtr())
 Checks in and therefore makes the authority valid by providing a namespace and a name. More...
 
void checkin (Authority &iParent, const ResourceName &ns, const std::string &name)
 Checks in the authority as sub-authority of parent. More...
 
void checkin (Authority &iParent, const std::string &name)
 Checks in the authority as sub-authority of parent. More...
 
void checkout ()
 Checks out and therefore invalidates the authority. More...
 
bool isValid () const
 Returns true, if this Authority was initialized and is checked in, otherwise false. More...
 
void validate () const
 Check if authority is checked in and therefore valid. More...
 
AuthorityRuntimePtr getRuntime ()
 Returns a shared_ptr to the runtime that this authority uses. More...
 
std::set< Authority * > getChildren ()
 Returns a set with all children / sub-authorities. More...
 
void addImmediateHandler (DiagnosticRunnablePtr runnable)
 Adds a runnable that is invoked immediately. More...
 
template<typename F >
void addImmediateHandlerFunction (F &&fn)
 Adds a handler function that is invoked immediately. More...
 
void addFinalizeHandler (DiagnosticRunnablePtr runnable)
 Adds a runnable that is executed ONCE just before the thread terminates. More...
 
template<typename F >
void addFinalizeHandlerFunction (F &&fn)
 Adds a function that is executed ONCE just before the thread terminates. More...
 
TimerPtr createTimer (Duration period, TimerCallback callback, bool oneshot=false)
 Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation. More...
 
TimerPtr createTimer (Duration period, Duration tolerance, TimerCallback callback, bool oneshot=false)
 Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, void(Class::*f)(const Timer &), Class *obj, bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, void(Class::*f)(const Timer &), bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, Duration tolerance, void(Class::*f)(const Timer &), Class *obj, bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Duration period, Duration tolerance, void(Class::*f)(const Timer &), bool oneshot=false)
 Provided for convenience. See above createTimer method for more details. More...
 
TimerPtr createTimer (Time time, TimerCallback callback)
 Creates a timer that calls callback exactly once at the given time. More...
 
template<typename Class >
TimerPtr createTimer (Time time, void(Class::*f)(const Timer &), Class *obj)
 Provided for convenience. See above createTimer method for more details. More...
 
template<typename Class >
TimerPtr createTimer (Time time, void(Class::*f)(const Timer &))
 Provided for convenience. See above createTimer method for more details. More...
 
void removeTimer (TimerPtr timer)
 Removes the given timer (timer callback will not be called again and timer will not be rescheduled). More...
 
virtual void start ()
 Starts/Resumes the main dispatcher thread if it is not yet started since the authority was created and checked in manually. More...
 
virtual void stop ()
 Stops/Pauses the main dispatcher thread. More...
 
bool spin (const Duration &maxWait=Duration::infinity())
 Executes a single step of the main dispatcher of this authority. More...
 
virtual bool hasUnrecoverableFailure () const
 Returns true, if there was a failure while processing the immediate handlers. More...
 
virtual bool isStarted () const
 Returns true, if the authority was started (by calling start()). More...
 
virtual bool isRunning () const
 Return if the authority's main dispatcher is running. More...
 
Channel Communication Access.

The following methods gain access to the channels for communication and allow to control the subscriptions of the Authority

std::string resolveName (const std::string &name) const
 Resolve a given name by taking the namespace of the authority into account. More...
 
std::string resolveServiceName (const std::string &name) const
 Resolves the given name of the service by taking the namespace of the authority into account. More...
 
template<typename T >
Channel< T > publish (const std::string &channelID)
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publish (const std::string &channelID, const Typename &type)
 Same as publish(channelID). More...
 
void unpublish (const std::string &channelID)
 Unpublish a channel with the given channel id. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, const Duration &storageDuration=Duration::seconds(0))
 Subscribes authority to a given channel. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Subscribes authority to a given channel and adds callback function fn. More...
 
template<typename T >
Channel< T > subscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, bool independentThread)
 Provided for convenience. See above subscribe method for more details. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, bool independentThread)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function of a class as callback. More...
 
template<typename T , typename Class >
Channel< T > subscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
 Provided for simplified registration of a member function as callback. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, const Duration &storageDuration=Duration::seconds(0))
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Publishes a channel with the given id and marks the authority as a publisher of this channel. More...
 
template<typename T >
Channel< T > publishAndSubscribe (const std::string &channelID, boost::function< void(ChannelRead< T >)> fn, bool independentThread)
 Provided for convenience. See above publishAndSubscribe method for more details. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, bool independentThread)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false)
 Provided for simplified registration of a member function of a class as callback. More...
 
template<typename T , typename Class >
Channel< T > publishAndSubscribe (const std::string &channelID, void(Class::*f)(ChannelRead< T >), bool independentThread)
 Provided for simplified registration of a member function as callback. More...
 
template<typename T >
Channel< T > subscribeInterval (const std::string &channelID, boost::function< void(ChannelReadInterval< T >)> fn, const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Subscribes authority to a given channel. More...
 
template<typename T , typename Class >
Channel< T > subscribeInterval (const std::string &channelID, void(Class::*f)(ChannelReadInterval< T >), Class *obj, const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 
template<typename T , typename Class >
Channel< T > subscribeInterval (const std::string &channelID, void(Class::*f)(ChannelReadInterval< T >), const Duration &storageDuration, bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Provided for simplified registration of a member function as callback function. More...
 
template<typename T , typename Class >
Channel< T > subscribeIntervalByElements (const std::string &channelID, void(Class::*f)(ChannelRead< T >), Class *obj, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Provided for simplified registration of a member function taking a simple ChannelRead as parameter. More...
 
template<typename T >
Channel< T > subscribeIntervalByElements (const std::string &channelID, boost::function< void(ChannelRead< T >)>, const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 General case accepting boost function instead of member function for subscribing to an interval with only a ChannelRead function given. More...
 
template<typename T , typename Class >
Channel< T > subscribeIntervalByElements (const std::string &channelID, void(Class::*f)(ChannelRead< T >), const Duration &storageDuration=Duration::seconds(0), bool independentThread=false, const Time &startAfter=Time::unixEpoch())
 Simplified notation automatically taking authority object as this argument. More...
 
template<typename T >
ChannelRead< T > waitForData (Channel< T > channel, Duration timeout=Duration::infinity()) const
 Waits until data in the specified channel becomes available. More...
 
template<typename T >
void unsubscribe (const std::string &channelID)
 Unsubscribe from a given channel. More...
 
template<typename T >
Channel< T > getChannel (const std::string &channelID)
 Returns channel object that can be used to obtain read and write access on the channel. More...
 
bool isSubscribedOn (const std::string &channelID) const
 Returns if this authority is subscribed to a channel with the given channel id. More...
 
 MIRA_DEPRECATED ("Please use isSubscribedOn() instead", bool hasSubscribedOn(const std::string &channelID) const)
 
bool hasPublished (const std::string &channelID) const
 Returns if this authority has published a channel with the given channel id. More...
 
bool doesChannelExist (const std::string &channelID) const
 Returns if a channel with the given channel id exists. More...
 
bool waitForChannel (const std::string &channelID, const Duration &timeout=Duration::infinity()) const
 Waits until a channel with the given channel id becomes available. More...
 
Access to Transform Framework.

The following methods allow to use the transformation framework.

bool isTransformAvailable (const std::string &targetID, const std::string &sourceID) const
 Checks if a transform from source frame to target frame is available. More...
 
bool isTransformAvailable (const std::string &targetID, const std::string &sourceID, const std::string &fixedID) const
 Checks if a transform from source frame to target frame via fixed frame is available. More...
 
bool waitForTransform (const std::string &targetID, const std::string &sourceID, Duration timeout=Duration::invalid()) const
 Waits until a transform from source frame to target frame is available. More...
 
bool waitForTransform (const std::string &targetID, const std::string &sourceID, const std::string &fixedID, Duration timeout=Duration::invalid()) const
 Waits until a transform from source frame to target frame via fixed frame is available. More...
 
template<typename Transform , typename Filter >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, boost::function< void(Transform, Time)> fn, Filter &&filter)
 Subscribes to a transformation between the given target and source frame. More...
 
template<typename Transform , typename Filter , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Class *obj, Filter &&filter)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Filter , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Filter &&filter)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, boost::function< void(Transform, Time)> fn)
 Subscribes to a transformation between the given target and source frame. More...
 
template<typename Transform , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time), Class *obj)
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Class >
void subscribeTransform (const std::string &targetID, const std::string &sourceID, void(Class::*f)(Transform, Time))
 Provided for simplified registration of a member function as callback function. More...
 
template<typename Transform , typename Filter >
Transform getTransform (const std::string &targetID, const std::string &sourceID, const Time &time, Filter &&filter) const
 Get a transformation from source to target frame at a given time stamp. More...
 
template<typename Transform >
Transform getTransform (const std::string &targetID, const std::string &sourceID, const Time &time=Time()) const
 
template<typename Transform , typename Filter >
Transform getTransform (const std::string &targetID, const Time &targetTime, const std::string &sourceID, const Time &sourceTime, const std::string &fixedID, Filter &&filter) const
 Get a transformation from source to target via fixed frame at the given time stamps. More...
 
template<typename Transform >
Transform getTransform (const std::string &targetID, const Time &targetTime, const std::string &sourceID, const Time &sourceTime, const std::string &fixedID) const
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &time, Filter &&filter) const
 Get a transformation at a given time using the prepared transform chain and a given filter. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &time=Time()) const
 
template<typename Transform , typename Filter >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime, Filter &&filter) const
 Get a transformation at the given times using the prepared transform chain and a given filter. More...
 
template<typename Transform >
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime) const
 
FrameworkTransformerNodegetTransformNode (const std::string &frameID) const
 Get a transformation node for the given frame. More...
 
TransformDesc prepareTransform (const std::string &targetID, const std::string &sourceID) const
 Prepares a transformation chain from a source node to a target node. More...
 
TransformDesc prepareTransform (const std::string &targetID, const std::string &sourceID, const std::string &fixedID) const
 Prepares a transformation chain from a source node to a target node via fixed node. More...
 
template<typename Transform >
void publishTransform (const std::string &frameID, const Transform &transform, const Time &time) const
 Publish a transformation for a given frame. More...
 
template<typename Transform , typename Filter >
void publishTransformIndirect (const std::string &frameID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time, Filter &&filter) const
 Publish a transformation (frameID) indirect by specifying a direct transform between two nodes (sourceID and targetID). More...
 
template<typename Transform >
void publishTransformIndirect (const std::string &frameID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time)
 
void addTransformLink (const std::string &childID, const std::string &parentID) const
 Add a transformation link between the given child and parent. More...
 
void addTransformLink (const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type) const
 Add a transformation link between the given child and parent, specifying the type of the transformation. More...
 
Remote Procedure Calls.

The following methods allow to register and use remote procedure calls.

template<typename Service >
void publishService (const std::string &name, Service &iService, RPCHandlerPtr handler=RPCHandlerPtr())
 Publish a service to register RPC functions at the RPC manager. More...
 
template<typename Service >
void publishService (Service &iService, RPCHandlerPtr handler=RPCHandlerPtr())
 Publish a service to register RPC functions at the RPC manager. More...
 
void unpublishService ()
 Unpublish this service by unregistering the service with the id of the authority from the RPC manager. More...
 
void unpublishService (const std::string &name)
 Unpublish a service with a given name by unregistering the service with the name from the RPC manager. More...
 
template<typename R , typename... ARGS>
RPCFuture< R > callService (const std::string &iService, const std::string &method, ARGS &&... args) const
 Performs an RPC call. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const json::Value &jsonRequest) const
 Invokes a JSON RPC call. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &jsonString) const
 Provided for convenience. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &service, const std::string &method, const json::Value &params=json::Value()) const
 Invokes a JSON RPC call, on the specified service and method with the given params by generating a JSON RPC 2.0 conform json request. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const std::string &service, const std::string &method, const std::string &params) const
 Provided for convenience. More...
 
RPCFuture< JSONRPCResponsecallServiceJSON (const RPCCallDefinition &rpc) const
 Provided for convenience. More...
 
bool existsService (const std::string &name) const
 Returns true, if a service with the given name exists, otherwise false. More...
 
bool implementsInterface (const std::string &name, const std::string &interface) const
 Returns true, if a service with the given name implements the given interface, otherwise false. More...
 
bool waitForService (const std::string &name, Duration timeout=Duration::invalid()) const
 Waits until a service with the specified name becomes available. More...
 
std::string waitForServiceInterface (const std::string &interface, Duration timeout=Duration::invalid()) const
 Waits until a service with the specified interface becomes available. More...
 
std::list< std::string > queryServicesForInterface (const std::string &interface) const
 Returns a string list with the names of all registered services, that implement the specified interface. More...
 
void registerCallbackForInterface (const std::string &interface, ServiceInterfaceHandler::Callback cb)
 Registers a callback that is called whenever a service registers the given interface, which is specified as first parameter. More...
 
template<typename Class >
void registerCallbackForInterface (const std::string &interface, void(Class::*f)(const std::string &, const std::string &), Class *obj)
 Same as above but providing a function and class pointer instead of a boost function. More...
 
Implementation of AbstractAuthority
virtual StatusManager::StatusMap getStatusMap ()
 Return a status map that contains the status of the authority as well as all registered submodules. More...
 
virtual boost::shared_ptr< PropertyNodegetProperties ()
 Returns the main property node of this Authority. More...
 
virtual std::set< std::string > getPublishedChannels ()
 Returns all published channels by this authority (and its sub-authorities) More...
 
virtual std::set< std::string > getSubscribedChannels ()
 Returns all subscribed channels by this authority (and its sub-authorities) More...
 
virtual std::set< std::string > getServiceInterfaces ()
 Returns all service interfaces provided by this authority. More...
 
virtual ChannelNameMapping getPublishedChannelNames ()
 Returns all published channels (pair of global and local names) by this authority (and its sub-authorities) More...
 
virtual ChannelNameMapping getSubscribedChannelNames ()
 Returns all subscribed channels (pair of global and local names) by this authority (and its sub-authorities) More...
 
virtual ChannelStatusMap getSubscribedChannelStatus ()
 Returns status for all subscribed channels (ok, no publisher, no data, ...) by this authority (and its sub-authorities) More...
 
Detailed Information Retrieval

These methods allow to obtain detailed information on the Authority.

std::string getNamespace () const
 Return the resolved namespace of the authority. More...
 
std::string getGlobalName () const
 Return the fully qualified global name (includes namespace) This method returns the name without the trailing UUID added if the authority is anonymous. More...
 
std::string getGlobalID () const
 Return the fully qualified global id (includes namespace) More...
 
std::string getID () const
 Return the id of the authority. More...
 
const AuthorityDescriptiongetDescription () const
 Return the description of this authority. More...
 

Static Public Member Functions

static PseudoClass const & CLASS ()
 

Protected Types

enum  OptionalMode { NOT_REQUIRED, REQUIRED }
 
typedef std::map< std::string, RWAccessFlagsRWAccessMap
 
typedef std::list< AbstractChannelSubscriberPtrSubscribePtrList
 

Protected Member Functions

virtual void channelChanged ()
 
virtual void dataChanged (ChannelRead< T > data)
 
virtual std::string defaultText ()
 
virtual void onEdit ()
 
virtual void redraw ()
 
virtual void writeJSON (const Time &timestamp, const std::string &frameID, int sequenceID, const json::Value &value)
 
virtual IVisualizationTextItemgetItem ()
 Get the visualization item. More...
 
virtual void update (Duration dt)
 This method can be implemented in the derived Visualization classes. More...
 
virtual void onUpdate (Duration dt)
 Provided for backward compatibility. More...
 
template<typename T , typename Reflector >
void channelProperty (Reflector &r, const std::string &name, ChannelProperty< T > &channel, const std::string &comment, OptionalMode optional=REQUIRED)
 Special property-method that should be called within the reflect method to specify a ChannelProperty. More...
 
virtual Class const & internalGetClass () const =0
 
template<typename T >
Channel< T > toProxy (ConcreteChannel< T > *channel)
 
void setChannelReadAccess (const std::string &channelID)
 
void setChannelWriteAccess (const std::string &channelID)
 
void removeChannelReadAccess (const std::string &channelID)
 
void removeChannelWriteAccess (const std::string &channelID)
 
void insertChannelNameMapping (AbstractAuthority::ChannelNameMapping &map, const std::string &local, const std::string &global)
 
void eraseChannelNameMapping (AbstractAuthority::ChannelNameMapping &map, const std::string &local, const std::string &global)
 
void remotePublishService (const std::string &service) const
 
PropertyTree getPropertiesRPC ()
 
void setProperty (const std::string &property, const std::string &value)
 
std::string getProperty (const std::string &property) const
 
void setPropertyJSON (const std::string &property, const json::Value &value)
 
json::Value getPropertyJSON (const std::string &property) const
 

Protected Attributes

std::string mName
 
ChannelProperty< T > mChannel
 
bool mFormatted
 
IVisualizationTextItemmItem
 
boost::optional< json::ValuemLastValue
 
Size2i mSize
 
uint mPrecision
 
AuthorityDescription mDescription
 
boost::optional< StatusmBootUpStatus
 
boost::optional< StatusmRecoverStatus
 
Duration mHeartbeatInterval
 
boost::optional< TimemLastHeartbeat
 
StatusMap mStatusMap
 

Member Typedef Documentation

◆ RWAccessMap

typedef std::map<std::string, RWAccessFlags> RWAccessMap
protectedinherited

◆ SubscribePtrList

typedef std::list<AbstractChannelSubscriberPtr> SubscribePtrList
protectedinherited

◆ ChannelNameMapping

typedef std::multimap<std::string, std::string> ChannelNameMapping
inherited

◆ ChannelStatusMap

typedef std::map<std::string, Status> ChannelStatusMap
inherited

◆ StatusMap

typedef std::map<std::string, Status> StatusMap
inherited

Member Enumeration Documentation

◆ OptionalMode

enum OptionalMode
protectedinherited
Enumerator
NOT_REQUIRED 
REQUIRED 

◆ Flags

enum Flags
inherited

Flags for creating an authority.

Enumerator
NORMAL 

Normally authorities must have a unique name.

ANONYMOUS 

However sometimes more than one instance is created of an authority where the name does not matter and could be generated automatically.

This flag provides automatically id generation based on uuids.

HIDDEN 

For Authorities that are not shown by default to the user.

Will get the MIRA_HIDDEN_AUTHORITY_PREFIX as name prefix.

INVISIBLE_PUBLISHER_SUBSCRIBER 

Authorities with this flag set are invisible subscribers and publishers for channels e.g.

they will not count as official publishers for channels which is used for remote framework connections. When a remote framework connects it will receive a list of all local published channels excluding the ones from invisible publishers.

INTERNAL 

Authorities with this flag set are automatically HIDDEN and are invisible to remote frameworks (internal to the local framework).

INDEPENDENT_SUBSCRIBER_THREAD 

Instructs the authority to use a separate and independent thread for handling subscriber callbacks.

By default the authority uses the same thread for handling

  • subscriber callbacks,
  • RPC calls
  • cyclic processes in order to relieve the user from the need to synchronize his/her threads. You can use a separate subscriber thread if you know that you will block inside of your cyclic process method or your RPC methods but need to react quickly and independently on subscriber callbacks.
INDEPENDENT_RPC_THREAD 

Instructs the authority to use a separate and independent thread for handling RPC requests.

By default the authority uses the same thread for handling

  • subscriber callbacks
  • RPC calls
  • cyclic processes in order to relieve the user from the need to synchronize his/her threads. You can use a separate RPC thread if you know that you will block inside of your subscriber callbacks or your cyclic process method but don't want to affect the RPC calls to your authority.
NO_MAIN_THREAD 

Does not start a thread for processing the main dispatcher, instead the user needs to call the spin() method periodically.

Constructor & Destructor Documentation

◆ VisualizationTextBasic()

VisualizationTextBasic ( const std::string &  channelName)
inline

◆ ~VisualizationTextBasic()

virtual ~VisualizationTextBasic ( )
inlinevirtual

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

◆ setupScene() [1/2]

virtual void setupScene ( IVisualizationTextSite site)
inlinevirtual

Must be implemented in derived classes.

Is called within the visualization's init() method. You can use this method to create your scene and scene objects. The passed IVisualizationTextSite interface is the same that is returned by getSite().

Implements VisualizationText.

◆ setSize()

virtual void setSize ( const Size2i size)
inlinevirtual

Reimplemented from VisualizationText.

◆ getSize()

virtual Size2i getSize ( ) const
inlinevirtual

Reimplemented from VisualizationText.

◆ setupScene() [2/2]

virtual void setupScene ( IVisualizationTextItem item)
inlinevirtual

◆ getDataConnection()

virtual DataConnection getDataConnection ( )
inlinevirtual

Returns information about the direct data connection for this visualization.

This information is used to support drag'n drop of channels into a visualization window to find the correct visualization for that data. Moreover, it is used in the tape player preview, etc. If your visualization should support these features you must implement this method by returning a valid DataConnection structure. By default an empty DataConnection structure is returned.

Reimplemented from Visualization.

◆ channelChanged()

virtual void channelChanged ( )
inlineprotectedvirtual

◆ dataChanged()

virtual void dataChanged ( ChannelRead< T >  data)
inlineprotectedvirtual

◆ defaultText()

virtual std::string defaultText ( )
inlineprotectedvirtual

◆ onEdit()

virtual void onEdit ( )
inlineprotectedvirtual

◆ redraw()

virtual void redraw ( )
inlineprotectedvirtual

Reimplemented from VisualizationText.

Reimplemented in DefaultTextVisualizationBase< T >.

◆ writeJSON()

virtual void writeJSON ( const Time timestamp,
const std::string &  frameID,
int  sequenceID,
const json::Value value 
)
inlineprotectedvirtual

◆ getItem()

virtual IVisualizationTextItem* getItem ( )
inlineprotectedvirtual

Get the visualization item.

Implements VisualizationText.

◆ init()

virtual void init ( IVisualizationSite site)
virtualinherited

Is called by the visualization view when the visualization is attached.

The default implementation stores the pointer to the IVisualizationTextSite interface that can be retrieved using the getSite() method for later use. Moreover, it calls the setupScene() method. You should never need to overwrite this method in derived classes. Use the setupScene() method instead. However, if you overwrite this method you SHOULD call this default implementation.

The passed interface must be of the type IVisualizationTextSite.

Implements Visualization.

◆ getSite()

virtual IVisualizationTextSite* getSite ( )
virtualinherited

Returns a pointer to the IVisualizationTextSite interface that was set in the init() method.

Or returns NULL, if init() was not yet called.

Implements Visualization.

◆ setPrecision()

void setPrecision ( uint  precision)
inherited

Set precision for displaying floating point numbers.

◆ processUpdate()

virtual void processUpdate ( Duration  dt)
virtualinherited

Is called regularly by the VisualizationView to update the visualization.

The time span since the last call of update is passed as parameter. It calls update() that can be overwritten in derived classes

◆ isEnabled()

bool isEnabled ( ) const
inlineinherited

Returns true, if this visualization is enabled and visible.

◆ setEnabled()

virtual void setEnabled ( bool  enabled)
inlinevirtualinherited

Changes the enabled-state and therefore the visibility of this visualization.

Derived classes should overwrite this method to hide and show the visualization as desired. When overwriting this method you should always call the method of the base class.

Reimplemented in Visualization3DBasic< T >, Visualization2DBasic< T >, and AxesVisualization.

◆ getName()

const std::string& getName ( void  ) const
inlineinherited

Returns the associated name of this visualization.

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Sets the name of this visualization.

◆ update()

virtual void update ( Duration  dt)
inlineprotectedvirtualinherited

This method can be implemented in the derived Visualization classes.

See processUpdate()

Reimplemented in Visualization3DBasic< T >, and Visualization2DBasic< T >.

◆ onUpdate()

virtual void onUpdate ( Duration  dt)
inlineprotectedvirtualinherited

Provided for backward compatibility.

Deprecated:
Please overwrite the update() method instead!

◆ setupDataConnectionChannel()

void setupDataConnectionChannel ( const std::string &  channelID)
inlineinherited

Sets up the data connection channel property (if any) with the specified channel id.

The property is added automatically to the channel property update set. Which is used for regular update of the properties. This method is for internal use, and called by VisualizationView upon a drag'n'drop action.

◆ channelProperty()

void channelProperty ( Reflector &  r,
const std::string &  name,
ChannelProperty< T > &  channel,
const std::string &  comment,
OptionalMode  optional = REQUIRED 
)
inlineprotectedinherited

Special property-method that should be called within the reflect method to specify a ChannelProperty.

E.g.:

template <typename Reflector>
void reflect(Reflector& r)
{
channelProperty(r, "MyChannel", myChannelProperty, "This is a comment to my channel");
}

◆ getAuthority()

virtual Authority& getAuthority ( )
virtualinherited

Return the authority as reference.

Implements IAuthorityProvider.

◆ getClass()

Class const& getClass ( ) const
inlineinherited

call the virtual internalGetClass().

◆ CLASS()

static PseudoClass const& CLASS ( )
inlinestaticinherited

◆ internalGetClass()

virtual Class const& internalGetClass ( ) const
protectedpure virtualinherited

◆ checkin() [1/4]

void checkin ( const ResourceName fullname,
AuthorityRuntimePtr  runtime = AuthorityRuntimePtr() 
)
inherited

Checks in and therefore makes the authority valid by providing a namespace and a name that are given as fully qualified resource name.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]fullnameThe fully qualified name of the authority, including the namespace.
[in]runtimeThe runtime the authority should use. If not specified the authority will create its own runtime.
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.

◆ checkin() [2/4]

void checkin ( const ResourceName ns,
const std::string &  name,
AuthorityRuntimePtr  runtime = AuthorityRuntimePtr() 
)
inherited

Checks in and therefore makes the authority valid by providing a namespace and a name.

This is essentially the same as the above method, but allows to specify namespace and name separately.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]nsThe namespace the authority will reside in
[in]nameThe name of the authority
[in]runtimeThe runtime the authority should use. If not specified the authority will create its own runtime.
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.

◆ checkin() [3/4]

void checkin ( Authority iParent,
const ResourceName ns,
const std::string &  name 
)
inherited

Checks in the authority as sub-authority of parent.

Hence, this authority will share some of the parents settings and runtime threads.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]iParentThe parent authority
[in]nsThe namespace the authority will reside in
[in]nameThe name of the authority
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.

◆ checkin() [4/4]

void checkin ( Authority iParent,
const std::string &  name 
)
inherited

Checks in the authority as sub-authority of parent.

Hence, this authority will share some of the parents settings (namespace, etc) and runtime threads.

Precondition
The authority must not be checked in.
Postcondition
The authority will be valid and checked in.
Parameters
[in]iParentThe parent authority
[in]nameThe name of the authority
Exceptions
XInvalidParameterIf another authority with the same name exists or if the specified namespace/name is invalid.

◆ checkout()

void checkout ( )
inherited

Checks out and therefore invalidates the authority.

Precondition
The authority must be checked in and valid
Postcondition
Authority is checked out. Every attempt to use the authority object again will throw an exception.

◆ isValid()

bool isValid ( ) const
inlineinherited

Returns true, if this Authority was initialized and is checked in, otherwise false.

◆ validate()

void validate ( ) const
inlineinherited

Check if authority is checked in and therefore valid.

Exceptions
XInvalidConfigif not checked in

◆ getRuntime()

AuthorityRuntimePtr getRuntime ( )
inlineinherited

Returns a shared_ptr to the runtime that this authority uses.

The returned pointer never is nullptr if this Authority was checked in successfully. The returned runtime may be shared between different Authorities.

◆ getChildren()

std::set<Authority*> getChildren ( )
inlineinherited

Returns a set with all children / sub-authorities.

◆ addImmediateHandler()

void addImmediateHandler ( DiagnosticRunnablePtr  runnable)
inherited

Adds a runnable that is invoked immediately.

After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid

◆ addImmediateHandlerFunction()

void addImmediateHandlerFunction ( F &&  fn)
inherited

Adds a handler function that is invoked immediately.

After the handler is processed it will be removed from the list of registered handlers. Creates a Runnable internally.

Precondition
The authority must be checked in and valid

◆ addFinalizeHandler()

void addFinalizeHandler ( DiagnosticRunnablePtr  runnable)
inherited

Adds a runnable that is executed ONCE just before the thread terminates.

After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid

◆ addFinalizeHandlerFunction()

void addFinalizeHandlerFunction ( F &&  fn)
inherited

Adds a function that is executed ONCE just before the thread terminates.

Creates a Runnable internally. After the handler is processed it will be removed from the list of registered handlers.

Precondition
The authority must be checked in and valid

◆ createTimer() [1/9]

TimerPtr createTimer ( Duration  period,
TimerCallback  callback,
bool  oneshot = false 
)
inherited

Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation.

Precondition
The authority must be checked in and valid
Parameters
[in]periodPeriod the timer is called in
[in]callbackFunction that gets called every time the timer fires.
[in]oneshotIf true callback is only called once.
Returns
pointer to created timer. Can be used for removeTimer().

◆ createTimer() [2/9]

TimerPtr createTimer ( Duration  period,
Duration  tolerance,
TimerCallback  callback,
bool  oneshot = false 
)
inherited

Creates and adds a timer that gets called cyclic in a given period (if oneshot is false) and calls the given callback on every invocation.

Additionally a warning is given when the call to the timer exceeds the scheduled invocation time about the specified tolerance.

Precondition
The authority must be checked in and valid
Parameters
[in]periodPeriod the timer is called in
[in]toleranceThe tolerance for exceeding the period.
[in]callbackFunction that gets called every time the timer fires.
[in]oneshotIf true callback is only called once.
Returns
pointer to created timer. Can be used for removeTimer().

◆ createTimer() [3/9]

TimerPtr createTimer ( Duration  period,
void(Class::*)(const Timer &)  f,
Class obj,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ createTimer() [4/9]

TimerPtr createTimer ( Duration  period,
void(Class::*)(const Timer &)  f,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ createTimer() [5/9]

TimerPtr createTimer ( Duration  period,
Duration  tolerance,
void(Class::*)(const Timer &)  f,
Class obj,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ createTimer() [6/9]

TimerPtr createTimer ( Duration  period,
Duration  tolerance,
void(Class::*)(const Timer &)  f,
bool  oneshot = false 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ createTimer() [7/9]

TimerPtr createTimer ( Time  time,
TimerCallback  callback 
)
inherited

Creates a timer that calls callback exactly once at the given time.

Precondition
The authority must be checked in and valid
Parameters
[in]timeTime when the callback should be called.
[in]callbackFunction that gets called at the given time.
Returns
pointer to created timer. Can be used for removeTimer().

◆ createTimer() [8/9]

TimerPtr createTimer ( Time  time,
void(Class::*)(const Timer &)  f,
Class obj 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ createTimer() [9/9]

TimerPtr createTimer ( Time  time,
void(Class::*)(const Timer &)  f 
)
inherited

Provided for convenience. See above createTimer method for more details.

◆ removeTimer()

void removeTimer ( TimerPtr  timer)
inherited

Removes the given timer (timer callback will not be called again and timer will not be rescheduled).

Calling start on a removed timer will not start it again.

◆ start()

virtual void start ( )
virtualinherited

Starts/Resumes the main dispatcher thread if it is not yet started since the authority was created and checked in manually.

Starts also dispatcher threads for rpc service calls.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

Reimplemented in Unit, MicroUnit, and QtUnit.

◆ stop()

virtual void stop ( )
virtualinherited

Stops/Pauses the main dispatcher thread.

To continue call start.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

Reimplemented in Unit, and MicroUnit.

◆ spin()

bool spin ( const Duration maxWait = Duration::infinity())
inherited

Executes a single step of the main dispatcher of this authority.

If this authority does not own the AuthorityRuntime with the main dispatcher, this method does nothing. The method returns true, if the caller should continue to call spin() periodically. If false is returned, spin() should not be called any longer.

Usually the spin() method waits for events and signals of the dispatcher, you can specify the max. time that is spent in the call using the maxWait parameter. If this parameter is set to 0, spin() will not block at all. If it is set to Duration::infinity (the default), it will wait until the next signal or event or stop request.

◆ hasUnrecoverableFailure()

virtual bool hasUnrecoverableFailure ( ) const
virtualinherited

Returns true, if there was a failure while processing the immediate handlers.

This is an unrecoverable failure that will disallow the further execution of the authority.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

◆ isStarted()

virtual bool isStarted ( ) const
virtualinherited

Returns true, if the authority was started (by calling start()).

It will return false, if the authority was not yet started or is stopped.

Implements AbstractAuthority.

◆ isRunning()

virtual bool isRunning ( ) const
virtualinherited

Return if the authority's main dispatcher is running.

Precondition
The authority must be checked in and valid

Implements AbstractAuthority.

◆ enableSubscriberCallbacks()

void enableSubscriberCallbacks ( bool  enable)
inherited

Enables/disables subscriptions.

If enabled, subscribed callbacks will be called upon changes in the channels. If false, callbacks will not be called.

◆ resolveName()

std::string resolveName ( const std::string &  name) const
inherited

Resolve a given name by taking the namespace of the authority into account.

Precondition
The authority must be checked in and valid
Parameters
[in]nameto be resolved
Returns
resolved name

◆ resolveServiceName()

std::string resolveServiceName ( const std::string &  name) const
inherited

Resolves the given name of the service by taking the namespace of the authority into account.

This method does essentially the same as resolveName() but takes a possible "#buildin" suffix into account.

Precondition
The authority must be checked in and valid
Parameters
[in]nameto be resolved
Returns
resolved name

◆ publish() [1/2]

Channel<T> publish ( const std::string &  channelID)
inlineinherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

If the channel does not exist it will be created.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe channel id
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().

◆ publish() [2/2]

Channel<T> publish ( const std::string &  channelID,
const Typename type 
)
inherited

Same as publish(channelID).

Use this for untyped channels Channel<void> to specify a typename.

◆ unpublish()

void unpublish ( const std::string &  channelID)
inherited

Unpublish a channel with the given channel id.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidConfigif authority is not valid
Parameters
[in]channelIDThe channel id

◆ subscribe() [1/7]

Channel<T> subscribe ( const std::string &  channelID,
const Duration storageDuration = Duration::seconds(0) 
)
inherited

Subscribes authority to a given channel.

It returns a channel object that the caller can store to poll/read data from the channel. The channel is created if it does not exists.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access accordig to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().

◆ subscribe() [2/7]

Channel<T> subscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Subscribes authority to a given channel and adds callback function fn.

At least one thread is created per authority for the callbacks. If independentThread is false the main thread for this authority is used for the channel callback. If independentThread is true an independent thread for this channel is created for the authority.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the maximum storage duration maxD can be computed by maxD = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().

◆ subscribe() [3/7]

Channel<T> subscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
bool  independentThread 
)
inherited

Provided for convenience. See above subscribe method for more details.

◆ subscribe() [4/7]

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribe() [5/7]

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
bool  independentThread 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribe() [6/7]

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inlineinherited

Provided for simplified registration of a member function of a class as callback.

Example:

class MyClass
{
public:
void initialize()
{
authority.subscribe<int>("MyChannel", &MyClass::myChannelCallback);
}
void myChannelCallback(ChannelRead<int> data);
};
See also
Authority::subscribe() for details.

◆ subscribe() [7/7]

Channel<T> subscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
bool  independentThread 
)
inlineinherited

Provided for simplified registration of a member function as callback.

See also
Authority::subscribe() for details.

◆ publishAndSubscribe() [1/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
const Duration storageDuration = Duration::seconds(0) 
)
inherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

Also subscribes authority to the channel. It returns a channel object that the caller can store to poll/read and write data from/to the channel. The channel is created if it does not exists.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
Returns
A Channel object that the caller can store to have fast access to the channel data

◆ publishAndSubscribe() [2/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Publishes a channel with the given id and marks the authority as a publisher of this channel.

Also subscribes authority to the channel and adds callback function fn. At least one thread is created per authority for the callbacks. If independentThread is false the main thread for this authority is used for the channel callback. If independentThread is true an independent thread for this channel is created for the authority.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the maximum storage duration maxD can be computed by maxD = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
Returns
A Channel object that the caller can store to have fast access to the channel data.

◆ publishAndSubscribe() [3/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  fn,
bool  independentThread 
)
inherited

Provided for convenience. See above publishAndSubscribe method for more details.

◆ publishAndSubscribe() [4/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above publishAndSubscribe methods for more details.

◆ publishAndSubscribe() [5/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
bool  independentThread 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above publishAndSubscribe methods for more details.

◆ publishAndSubscribe() [6/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false 
)
inlineinherited

Provided for simplified registration of a member function of a class as callback.

Example:

class MyClass
{
public:
void initialize()
{
authority.publishAndSubscribe<int>("MyChannel", &MyClass::myChannelCallback);
}
void myChannelCallback(ChannelRead<int> data);
};
See also
Authority::publishAndSubscribe() for details.

◆ publishAndSubscribe() [7/7]

Channel<T> publishAndSubscribe ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
bool  independentThread 
)
inlineinherited

Provided for simplified registration of a member function as callback.

See also
Authority::subscribe() for details.

◆ subscribeInterval() [1/3]

Channel<T> subscribeInterval ( const std::string &  channelID,
boost::function< void(ChannelReadInterval< T >)>  fn,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Subscribes authority to a given channel.

In contrast to the above subscribe methods this method subscribes a callback that takes a ChannelReadInterval as parameter. Instead of a single value, a whole interval of data is passed. The interval contains all values that were stored within the channel since the last callback. Hence, by using this subscribe mechanism you can make sure, that no data is missed.

Precondition
The authority must be checked in and valid
The channel must not exist or the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel exists but the types do not match.
Parameters
[in]channelIDThe id of the data channel to subscribe to
[in]fnThe callback function that is called whenever the data in the interval on the channel changes.
[in]storageDurationThe requested duration of how long data is stored in the channel (history). This parameter is especially important for subscribing to intervals, as it must be larger than the delay that may occur within the callback to make sure that no data is lost. Note that the real history length may differ from this request because the number of slots in the channel is limited by its maximum length. Assuming we have only one writer to the channel that updates the channel each T milliseconds the real storage duration D can be computed by D = (maxSlots-1) * T.
[in]independentThreadIf true, an independent thread is created for this channel callback
[in]startAfterIgnore any channel slots at or before this timestamp. If this is before the subscription time, the first callback (triggered by the first subsequent channel update) will collect all past channel slots back to this timestamp.
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().

◆ subscribeInterval() [2/3]

Channel<T> subscribeInterval ( const std::string &  channelID,
void(Class::*)(ChannelReadInterval< T >)  f,
Class obj,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

◆ subscribeInterval() [3/3]

Channel<T> subscribeInterval ( const std::string &  channelID,
void(Class::*)(ChannelReadInterval< T >)  f,
const Duration storageDuration,
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribeIntervalByElements() [1/3]

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
Class obj,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Provided for simplified registration of a member function taking a simple ChannelRead as parameter.

This is useful especially when trying to get every single value (e.g. message passing), even if processing of a single value takes some longer.

◆ subscribeIntervalByElements() [2/3]

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
boost::function< void(ChannelRead< T >)>  ,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

General case accepting boost function instead of member function for subscribing to an interval with only a ChannelRead function given.

◆ subscribeIntervalByElements() [3/3]

Channel<T> subscribeIntervalByElements ( const std::string &  channelID,
void(Class::*)(ChannelRead< T >)  f,
const Duration storageDuration = Duration::seconds(0),
bool  independentThread = false,
const Time startAfter = Time::unixEpoch() 
)
inherited

Simplified notation automatically taking authority object as this argument.

Same as respective subscribeInterval function taking ChannelReadInterval as parameter.

◆ waitForData()

ChannelRead<T> waitForData ( Channel< T >  channel,
Duration  timeout = Duration::infinity() 
) const
inherited

Waits until data in the specified channel becomes available.

If a timeout it specified, the method times out if no data becomes available after the given time.

Precondition
The authority must be checked in and valid
The authority must be subscribed to the given channel
Parameters
[in]channelThe channel we are waiting for
[in]timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
A valid ChannelRead, if data became available, or an invalid ChannelRead, if the method timed out or the thread was interrupted.

◆ unsubscribe()

void unsubscribe ( const std::string &  channelID)
inherited

Unsubscribe from a given channel.

If subscribed with a callback function this function is no longer called. If independentThread was true when subscribing the independent thread for this channel is stopped.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidConfigif authority is not valid
Parameters
[in]channelIDThe id of the data channel to subscribe to
Note
If subscribed with an independent callback function don't call this method inside the callback function. It will block forever because this method will stop the callback thread.

◆ getChannel()

Channel<T> getChannel ( const std::string &  channelID)
inherited

Returns channel object that can be used to obtain read and write access on the channel.

Precondition
The authority must be checked in and valid
The channel must exist and the type of the channel must match
Exceptions
XInvalidConfigif authority is not valid
XBadCastif the channel types do not match.
XAccessViolationif the channel does not exist
Returns
A Channel object that the caller can store to have fast access to the channel data
Note
The returned channel object only allows access according to the current access level of the authority at calling time. If you want to gain read and write access you have to call subscribe() and publish() and store the channel on the second call. Otherwise you can call subscribe() and publish() and obtain the channel object later by calling getChannel().

◆ isSubscribedOn()

bool isSubscribedOn ( const std::string &  channelID) const
inherited

Returns if this authority is subscribed to a channel with the given channel id.

◆ MIRA_DEPRECATED()

MIRA_DEPRECATED ( "Please use isSubscribedOn() instead"  ,
bool hasSubscribedOn(const std::string &channelID)  const 
)
inlineinherited
Parameters
const
Deprecated:
Please use isSubscribedOn() instead.

◆ hasPublished()

bool hasPublished ( const std::string &  channelID) const
inherited

Returns if this authority has published a channel with the given channel id.

◆ doesChannelExist()

bool doesChannelExist ( const std::string &  channelID) const
inherited

Returns if a channel with the given channel id exists.

◆ waitForChannel()

bool waitForChannel ( const std::string &  channelID,
const Duration timeout = Duration::infinity() 
) const
inherited

Waits until a channel with the given channel id becomes available.

◆ isTransformAvailable() [1/2]

bool isTransformAvailable ( const std::string &  targetID,
const std::string &  sourceID 
) const
inherited

Checks if a transform from source frame to target frame is available.

This means a path in the transform tree exists from source to target and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
Returns
true if transform is available, false otherwise

◆ isTransformAvailable() [2/2]

bool isTransformAvailable ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID 
) const
inherited

Checks if a transform from source frame to target frame via fixed frame is available.

This means a path in the transform tree exists from source to target via fixed and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
Returns
true if transform is available, false otherwise

◆ waitForTransform() [1/2]

bool waitForTransform ( const std::string &  targetID,
const std::string &  sourceID,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a transform from source frame to target frame is available.

This means a path in the transform tree exists from source to target and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
true if transform is available, false on timeout

◆ waitForTransform() [2/2]

bool waitForTransform ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a transform from source frame to target frame via fixed frame is available.

This means a path in the transform tree exists from source to target via fixed and all nodes on that path contain data.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
timeoutWait for this duration or forever if Duration::infinity() (default)
Returns
true if transform is available, false on timeout

◆ subscribeTransform() [1/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
boost::function< void(Transform, Time)>  fn,
Filter &&  filter 
)
inherited

Subscribes to a transformation between the given target and source frame.

Usually, the computation of the transformation between the target and source frame depends on multiple frames along the path between the 'target' and 'source' within the transformation tree. The installed callback function will be called whenever one of these frames and hence the transformation between the target and source frame changes. The latest transformation and the corresponding timestamp will be passed as parameter to the callback function. The transformation between target and source frame must exist, otherwise an XTransform exception is thrown. You can use waitForTransform to ensure that the transformation exists.

Precondition
The authority must be checked in and valid.
Exceptions
TransformerBase::XTransformIf the transformation between source and target does not exist.
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fnThe callback that is called when the transformation changes, the new transformation and the corresponding timestamp are passed as parameter.
filterThe filter used to interpolate between the transformations.

◆ subscribeTransform() [2/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Class obj,
Filter &&  filter 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribeTransform() [3/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Filter &&  filter 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribeTransform() [4/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
boost::function< void(Transform, Time)>  fn 
)
inherited

Subscribes to a transformation between the given target and source frame.

Usually, the computation of the transformation between the target and source frame depends on multiple frames along the path between the 'target' and 'source' within the transformation tree. The installed callback function will be called whenever one of these frames and hence the transformation between the target and source frame changes. The latest transformation and the corresponding timestamp will be passed as parameter to the callback function. The transformation between target and source frame must exist, otherwise an XTransform exception is thrown. You can use waitForTransform to ensure that the transformation exists.

Precondition
The authority must be checked in and valid.
Exceptions
TransformerBase::XTransformIf the transformation between source and target does not exist.
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fnThe callback that is called when the transformation changes, the new transformation and the corresponding timestamp are passed as parameter.

◆ subscribeTransform() [5/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f,
Class obj 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ subscribeTransform() [6/6]

void subscribeTransform ( const std::string &  targetID,
const std::string &  sourceID,
void(Class::*)(Transform, Time f 
)
inherited

Provided for simplified registration of a member function as callback function.

See the above subscribe methods for more details.

◆ getTransform() [1/8]

Transform getTransform ( const std::string &  targetID,
const std::string &  sourceID,
const Time time,
Filter &&  filter 
) const
inherited

Get a transformation from source to target frame at a given time stamp.

The specified filter is used. If time is "not_a_date_time" e.g. a default constructed Time(), the latest available transform is returned.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
timeThe time of the requested transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation

◆ getTransform() [2/8]

Transform getTransform ( const std::string &  targetID,
const std::string &  sourceID,
const Time time = Time() 
) const
inlineinherited
See also
getTransform(const std::string&, const std::string&, const Time&, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms. If time is "not_a_date_time" (the default value), the latest available transform is returned.

◆ getTransform() [3/8]

Transform getTransform ( const std::string &  targetID,
const Time targetTime,
const std::string &  sourceID,
const Time sourceTime,
const std::string &  fixedID,
Filter &&  filter 
) const
inherited

Get a transformation from source to target via fixed frame at the given time stamps.

The specified filter is used. This method can be used to do time traveling. For example if one wants to know what was the position of the right arm two seconds ago relative to the position the left arm has now:

Time t = Time::now();
getTransform("LeftArmFrame", t,
"RightArmFrame", t-Duration::seconds(2),
"RobotFrame");

The "RobotFrame" is chosen as "fixed frame" since it is fixed over time relative to the arm positions and hence can be used as reference frame.

One can read the parameters of this function like: Give the transform from frame targetID at targetTime to frame sourceID at time sourceTime specifying the frame fixedID that does not change over time

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target, source or fixed node does not exist
Parameters
targetIDThe frame id of the target node
targetTimeThe time of the target transform
sourceIDThe frame id of the source node
sourceTimeThe time of the source transform
fixedIDThe frame id of the fixed node
filterThe filter used to interpolate between the transforms
Returns
The requested transformation

◆ getTransform() [4/8]

Transform getTransform ( const std::string &  targetID,
const Time targetTime,
const std::string &  sourceID,
const Time sourceTime,
const std::string &  fixedID 
) const
inlineinherited
See also
getTransform(const std::string& targetID, const Time& targetTime, const std::string& sourceID, const Time& sourceTime, const std::string& fixedID, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms.

◆ getTransform() [5/8]

Transform getTransform ( const TransformDesc desc,
const Time time,
Filter &&  filter 
) const
inherited

Get a transformation at a given time using the prepared transform chain and a given filter.

If time is "not_a_date_time" e.g. a default constructed Time(), the latest available transform is returned.

Parameters
descThe prepared transform chain
timeThe time of the requested transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation

◆ getTransform() [6/8]

Transform getTransform ( const TransformDesc desc,
const Time time = Time() 
) const
inlineinherited
See also
getTransform(const TransformDesc&, const Time&, Filter&&) Here by default the NearestNeighborInterpolator is used for interpolation between transforms. If time is "not_a_date_time" (the default value), the latest available transform is returned.

◆ getTransform() [7/8]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime,
Filter &&  filter 
) const
inherited

Get a transformation at the given times using the prepared transform chain and a given filter.

This method can be used to do time traveling. Together with prepareTransform(const std::string&, const std::string&, const std::string&) the same functionality can be achieved as by calling getTransform(const std::string&, const Time&, const std::string&, const Time&, const std::string&, Filter&&)

Parameters
descThe prepared transform chain
targetTimeThe time of requested target transform
sourceTimeThe time of requested source transform
filterThe filter used to interpolate between the transforms
Returns
The requested transformation

◆ getTransform() [8/8]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime 
) const
inlineinherited
See also
getTransform(const TransformDesc&, const Time&, const Time&, Filter&&); Here by default the NearestNeighborInterpolator is used for interpolation between transforms.

◆ getTransformNode()

FrameworkTransformerNode* getTransformNode ( const std::string &  frameID) const
inherited

Get a transformation node for the given frame.

Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif node does not exist
Parameters
frameIDThe frame id of the requested node.
Returns
A pointer to the node

◆ prepareTransform() [1/2]

TransformDesc prepareTransform ( const std::string &  targetID,
const std::string &  sourceID 
) const
inherited

Prepares a transformation chain from a source node to a target node.

The chain can later be used to obtain a transform using getTransform(const TransformDesc&, const Time& time, Filter&&); Preparing the transform chain only once can save performance when calculating the transform very often.

Note
It is important that after preparing the transform chain the topology must not change.
Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
Returns
The prepared chain

◆ prepareTransform() [2/2]

TransformDesc prepareTransform ( const std::string &  targetID,
const std::string &  sourceID,
const std::string &  fixedID 
) const
inherited

Prepares a transformation chain from a source node to a target node via fixed node.

The chain can later be used to obtain a transform using getTransform(const TransformDesc&, const Time&, const Time&, Filter&&); Together with the above mentioned method the same functionality as calling getTransform(const std::string&, const Time&, const std::string&, const Time&, const std::string&, Filter&&) can be achieved, but preparing the transform chain only once can save performance when calculating the transform very often.

Note
It is important that after preparing the transform chain the topology must not change.
Precondition
The authority must be checked in and valid
Exceptions
XInvalidReadif either the target or source node does not exist
Parameters
targetIDThe frame id of the target node
sourceIDThe frame id of the source node
fixedIDThe frame id of the fixed node
Returns
The prepared chain

◆ publishTransform()

void publishTransform ( const std::string &  frameID,
const Transform &  transform,
const Time time 
) const
inherited

Publish a transformation for a given frame.

Precondition
The authority must be checked in and valid
Parameters
[in]frameIDThe id of the frame
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation

◆ publishTransformIndirect() [1/2]

void publishTransformIndirect ( const std::string &  frameID,
const std::string &  targetID,
const std::string &  sourceID,
const Transform &  transform,
const Time time,
Filter &&  filter 
) const
inherited

Publish a transformation (frameID) indirect by specifying a direct transform between two nodes (sourceID and targetID).

These two nodes are connected indirectly over the transformation (frameID) This is, the transformation (frameID) is inferred. In the case you know the direct 'transform' between 'targetID' and 'sourceID' you can use this method to publish the desired transform on the link 'frameID' at the specified 'time' and using the specified 'filter' for interpolation. In the following example there is a indirect link from sourceID to targetID via n1, n2, frameID and n3. The transform between source and target is known. The transform in frameID is inferred and published by calling this method.

n2 -------- n1 --- 'sourceID'
| .
| ??? . 'transform' (known)
| .
v v
'frameID' --- n3 --- 'targetID'
Precondition
The authority must be checked in and valid
Exceptions
XRuntimeif either the frame, target or source frames does not exist
Parameters
[in]frameIDThe id of the frame to publish indirectly
[in]targetIDThe frame id of the target node
[in]sourceIDThe frame id of the source node
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation
[in]filterThe filter used to interpolate between the transforms

◆ publishTransformIndirect() [2/2]

void publishTransformIndirect ( const std::string &  frameID,
const std::string &  targetID,
const std::string &  sourceID,
const Transform &  transform,
const Time time 
)
inlineinherited
See also
publishTransformIndirect(const std::string&, const std::string&, const std::string&, const Transform&, const Time&, Filter&&); Here by default the NearestNeighborInterpolator is used for interpolation between transforms.

◆ addTransformLink() [1/2]

void addTransformLink ( const std::string &  childID,
const std::string &  parentID 
) const
inherited

Add a transformation link between the given child and parent.

Creates child and/or parent if not existing.

Precondition
The authority must be checked in and valid
Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent

◆ addTransformLink() [2/2]

void addTransformLink ( const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
) const
inherited

Add a transformation link between the given child and parent, specifying the type of the transformation.

Creates child and/or parent if not existing.

Precondition
The authority must be checked in and valid
Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent
[in]typeLink type fixed/moving

◆ publishService() [1/2]

void publishService ( const std::string &  name,
Service &  iService,
RPCHandlerPtr  handler = RPCHandlerPtr() 
)
inherited

Publish a service to register RPC functions at the RPC manager.

You can publish more than one service object with the same service name

Parameters
[in]nameThe name under which the service is registered. Please note that the name is resolved depending on the namespace the authority is located in.
[in]iServiceThe service object to register.
[in]handlerThe handler that is used for processing the RPC calls if null internal handler is used (default)

◆ publishService() [2/2]

void publishService ( Service &  iService,
RPCHandlerPtr  handler = RPCHandlerPtr() 
)
inherited

Publish a service to register RPC functions at the RPC manager.

As name of the service the id of the authority is used.

Parameters
[in]iServiceThe service object to register.
[in]handlerThe handler that is used for processing the RPC calls if null internal handler is used (default)

◆ unpublishService() [1/2]

void unpublishService ( )
inherited

Unpublish this service by unregistering the service with the id of the authority from the RPC manager.

◆ unpublishService() [2/2]

void unpublishService ( const std::string &  name)
inherited

Unpublish a service with a given name by unregistering the service with the name from the RPC manager.

◆ callService()

RPCFuture<R> callService ( const std::string &  iService,
const std::string &  method,
ARGS &&...  args 
) const
inlineinherited

Performs an RPC call.

This method calls the specified RPC method of the specified service. Depending on the called method the parameters of the RPC call need to be specified as additional parameters. The result of the RPC call can be obtained via the RPCFuture that is returned by this method. The RPCFuture acts as a proxy for the result of the asynchronous RPC call. It can be used to block until the RPC call has finished and the result is available.

Parameters
serviceThe name of the service
methodThe method name of the requested call
p1First optional parameter see pn
pnVariable number of optional parameters. The number and type depends on the requested RPC method. Both will be checked by the receiver of the RPC call. If the parameter types do not match to the called RPC method, the server will return an error.
Returns
Returns an RPCFuture object. The type of the RPCFuture depends on the return type of the RPC method. It allows the caller to wait for the RPC call to finish and to retrieve the return value.

When calling this method the return type of the RPC method needs to be specified as template parameter.

Example:

RPCFuture<float> result = callService<float>("myservice", "mymethod", 123, 1.23f);
result.wait(); // wait for the result
float r = result.get(); // get the result value

◆ callServiceJSON() [1/5]

RPCFuture<JSONRPCResponse> callServiceJSON ( const json::Value jsonRequest) const
inherited

Invokes a JSON RPC call.

jsonCall must follow the JSON RPC 2.0 protocol. It must contain:

  • "jsonrpc" with exactly the value "2.0"
  • "id" an id that can be anything (int, string, null) but should be an unique identifier
  • "method" a service-method combination of the service to call (e.g. "/MyService.myMethod")
  • "params" Optional. Required only for methods with parameters. An array containing the parameters of the method to call (e.g. [1, "Hello World"]).
    {
    "jsonrpc" : "2.0",
    "id" : 1,
    "method" : "/ns/Service.setInt",
    "params" : [255]
    }
    Calls RPCManager::callJSON(const json::Value& jsonCall) internally.
    Returns
    Returns a future that will enclose the JSON RPC response containing the result of the call.

◆ callServiceJSON() [2/5]

RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  jsonString) const
inherited

Provided for convenience.

See callServiceJSON above. Calls RPCManager::callJSON(const std::string& jsonCall) internally.

Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.

◆ callServiceJSON() [3/5]

RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  service,
const std::string &  method,
const json::Value params = json::Value() 
) const
inherited

Invokes a JSON RPC call, on the specified service and method with the given params by generating a JSON RPC 2.0 conform json request.

Call id will be automatically generated. Calls RPCManager::callJSON(const std::string& service, const std::string& method, const json::Value& params) internally (after resolving the service).

Parameters
[in]serviceThe service to call
[in]methodThe method on the service to call
[in]paramsThe parameters for the method to call (must be a json::Array or json null value (default))
Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.

◆ callServiceJSON() [4/5]

RPCFuture<JSONRPCResponse> callServiceJSON ( const std::string &  service,
const std::string &  method,
const std::string &  params 
) const
inherited

Provided for convenience.

See callServiceJSON above. Calls RPCManager::callJSON(const std::string& service, const std::string& method, const std::string& params) internally (after resolving the service).

Parameters
[in]serviceThe service to call
[in]methodThe method on the service to call
[in]paramsThe parameters of the method as comma separated strings (JSON, no enclosing [], empty string if no parameters)
Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.

◆ callServiceJSON() [5/5]

RPCFuture<JSONRPCResponse> callServiceJSON ( const RPCCallDefinition rpc) const
inherited

Provided for convenience.

See callServiceJSON above. Will extract parameters to call callServiceJSON(const std::string& service, const std::string& method, const std::string& params) internally (after resolving the service).

Returns
Returns a future that will enclose the JSON RPC response containing the result of the call.

◆ existsService()

bool existsService ( const std::string &  name) const
inherited

Returns true, if a service with the given name exists, otherwise false.

◆ implementsInterface()

bool implementsInterface ( const std::string &  name,
const std::string &  interface 
) const
inherited

Returns true, if a service with the given name implements the given interface, otherwise false.

◆ waitForService()

bool waitForService ( const std::string &  name,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a service with the specified name becomes available.

If a timeout is specified, the method times out if no such service becomes available after the given time. Returns true, if the desired services became available, or false, if the method timed out or the thread was interrupted.

◆ waitForServiceInterface()

std::string waitForServiceInterface ( const std::string &  interface,
Duration  timeout = Duration::invalid() 
) const
inherited

Waits until a service with the specified interface becomes available.

If a timeout is specified, the method times out if no such service becomes available after the given time. Returns the name of the service, if the desired services became available, or an empty string, if the method timed out or the thread was interrupted.

◆ queryServicesForInterface()

std::list<std::string> queryServicesForInterface ( const std::string &  interface) const
inherited

Returns a string list with the names of all registered services, that implement the specified interface.

◆ registerCallbackForInterface() [1/2]

void registerCallbackForInterface ( const std::string &  interface,
ServiceInterfaceHandler::Callback  cb 
)
inherited

Registers a callback that is called whenever a service registers the given interface, which is specified as first parameter.

The callback method must take two parameters of the type std::string: method(const std::string& interface, const std::string& service); When the method is called, the name of the interface and the name of the service that is registering is passed. The callback is processed within the main dispatcher thread of the authority.

◆ registerCallbackForInterface() [2/2]

void registerCallbackForInterface ( const std::string &  interface,
void(Class::*)(const std::string &, const std::string &)  f,
Class obj 
)
inherited

Same as above but providing a function and class pointer instead of a boost function.

Provided for convenience.

◆ getStatusManager()

StatusManager& getStatusManager ( )
inherited

◆ getStatusMap() [1/2]

virtual StatusManager::StatusMap getStatusMap ( )
virtualinherited

Return a status map that contains the status of the authority as well as all registered submodules.

Implements AbstractAuthority.

◆ getStatusMap() [2/2]

StatusMap getStatusMap ( ) const
inherited

Gets the current status map containing all errors, warnings and bootup messages.

◆ getProperties()

virtual boost::shared_ptr<PropertyNode> getProperties ( )
virtualinherited

Returns the main property node of this Authority.

Implements AbstractAuthority.

Reimplemented in MicroUnit.

◆ getPublishedChannels()

virtual std::set<std::string> getPublishedChannels ( )
virtualinherited

Returns all published channels by this authority (and its sub-authorities)

Implements AbstractAuthority.

◆ getSubscribedChannels()

virtual std::set<std::string> getSubscribedChannels ( )
virtualinherited

Returns all subscribed channels by this authority (and its sub-authorities)

Implements AbstractAuthority.

◆ getServiceInterfaces()

virtual std::set<std::string> getServiceInterfaces ( )
virtualinherited

Returns all service interfaces provided by this authority.

Implements AbstractAuthority.

◆ getPublishedChannelNames()

virtual ChannelNameMapping getPublishedChannelNames ( )
virtualinherited

Returns all published channels (pair of global and local names) by this authority (and its sub-authorities)

Implements AbstractAuthority.

◆ getSubscribedChannelNames()

virtual ChannelNameMapping getSubscribedChannelNames ( )
virtualinherited

Returns all subscribed channels (pair of global and local names) by this authority (and its sub-authorities)

Implements AbstractAuthority.

◆ getSubscribedChannelStatus()

virtual ChannelStatusMap getSubscribedChannelStatus ( )
virtualinherited

Returns status for all subscribed channels (ok, no publisher, no data, ...) by this authority (and its sub-authorities)

Implements AbstractAuthority.

◆ toProxy()

Channel<T> toProxy ( ConcreteChannel< T > *  channel)
protectedinherited

◆ setChannelReadAccess()

void setChannelReadAccess ( const std::string &  channelID)
protectedinherited

◆ setChannelWriteAccess()

void setChannelWriteAccess ( const std::string &  channelID)
protectedinherited

◆ removeChannelReadAccess()

void removeChannelReadAccess ( const std::string &  channelID)
protectedinherited

◆ removeChannelWriteAccess()

void removeChannelWriteAccess ( const std::string &  channelID)
protectedinherited

◆ insertChannelNameMapping()

void insertChannelNameMapping ( AbstractAuthority::ChannelNameMapping map,
const std::string &  local,
const std::string &  global 
)
protectedinherited

◆ eraseChannelNameMapping()

void eraseChannelNameMapping ( AbstractAuthority::ChannelNameMapping map,
const std::string &  local,
const std::string &  global 
)
protectedinherited

◆ remotePublishService()

void remotePublishService ( const std::string &  service) const
protectedinherited

◆ getPropertiesRPC()

PropertyTree getPropertiesRPC ( )
protectedinherited

◆ setProperty()

void setProperty ( const std::string &  property,
const std::string &  value 
)
protectedinherited

◆ getProperty()

std::string getProperty ( const std::string &  property) const
protectedinherited

◆ setPropertyJSON()

void setPropertyJSON ( const std::string &  property,
const json::Value value 
)
protectedinherited

◆ getPropertyJSON()

json::Value getPropertyJSON ( const std::string &  property) const
protectedinherited

◆ getNamespace()

std::string getNamespace ( ) const
inlineinherited

Return the resolved namespace of the authority.

Returns
Namespace

◆ getGlobalName()

std::string getGlobalName ( ) const
inlineinherited

Return the fully qualified global name (includes namespace) This method returns the name without the trailing UUID added if the authority is anonymous.

Use getGlobalID() to obtain the unique id of the authority.

Returns
Global Name

◆ getGlobalID()

std::string getGlobalID ( ) const
inlineinherited

Return the fully qualified global id (includes namespace)

Returns
Global ID

◆ getID()

std::string getID ( ) const
inlineinherited

Return the id of the authority.

Returns
ID

◆ getDescription()

const AuthorityDescription& getDescription ( ) const
inlineinherited

Return the description of this authority.

◆ setHeartbeatInterval()

void setHeartbeatInterval ( const Duration interval)
inlineinherited

Set the watchdog interval.

◆ getHeartbeatInterval()

Duration getHeartbeatInterval ( ) const
inlineinherited

Return the watchdog interval.

◆ heartbeat()

void heartbeat ( )
inlineinherited

When called for the first time heartbeat usage will be enabled.

This resets the watchdog and signal that everything is working. If you call heartbeat in an interval < watchdog interval the status will be OK (if no other error is set) If a module blocks or fails and does not call heartbeat again until the watchdog interval passed the status will be ERROR

◆ hasHeartbeatTimeout()

bool hasHeartbeatTimeout ( ) const
inlineinherited

Returns true if heartbeat usage is enabled (by first call to heartbeat()) and last heartbeat was more than heartbeat interval time ago.

◆ bootup()

void bootup ( const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal that the module is booting up.

Optional a message text and a text used for translation can be specified

◆ bootupFinished()

void bootupFinished ( )
inherited

Signal that the module has finished booting up (There can still be errors but booting up is finished)

◆ recoverFinished()

void recoverFinished ( )
inherited

Signal that the module has finished recovering (There can still be errors but recovering is finished)

◆ recover()

void recover ( const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal that the module is recovering.

Optional a message text and a text used for translation can be specified

◆ ok()

void ok ( const std::string &  category = "")
inherited

Signal that a category contains no more errors.

If no category is set all categories are cleared (except boot up).

◆ warning()

bool warning ( const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal a warning in a category.

A message and an optional text for translation can be given. Additionally, the message is written to the error log.

Returns
true if warning was set, false if a warning with same text was already set

◆ error()

bool error ( const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Signal an error in a category.

A message and an optional text for translation can be given. Additionally, the error message is written to the error log.

Returns
true if error was set, false if a error with same text was already set

◆ setStatus()

bool setStatus ( Status::StatusMode  mode,
const std::string &  category,
const std::string &  message,
const std::string &  trText = "" 
)
inherited

Set the status of a given category.

This method can be used to set the warning or error status of the specified category. a message and an optional text for translation can be given. This method essentially does the same as the above warning() and error() methods. In contrast to those two methods, this method does NOT write the error message to the error/warning log. Hence, it can be used to set the error and warning status silently. In all other cases the warning() and error() methods should be used, which are more convenient.

Returns
true if error was set, false if a error with same text was already set

◆ getStatus()

Status::StatusMode getStatus ( ) const
inherited

Get the status mode defined by the status of the watchdog (if used) and the bootup, error and warning methods.

If the watchdog is used (watchdog is enabled when calling heartbeat() for the first time) this method tests if the latest reset of the watchdog was inside the specified watchdog interval. If not it will return ERROR.

Member Data Documentation

◆ mName

std::string mName
protected

◆ mChannel

ChannelProperty<T> mChannel
protected

◆ mFormatted

bool mFormatted
protected

◆ mItem

IVisualizationTextItem* mItem
protected

◆ mLastValue

boost::optional<json::Value> mLastValue
protected

◆ mSize

Size2i mSize
protectedinherited

◆ mPrecision

uint mPrecision
protectedinherited

◆ mDescription

AuthorityDescription mDescription
protectedinherited

◆ mBootUpStatus

boost::optional<Status> mBootUpStatus
protectedinherited

◆ mRecoverStatus

boost::optional<Status> mRecoverStatus
protectedinherited

◆ mHeartbeatInterval

Duration mHeartbeatInterval
protectedinherited

◆ mLastHeartbeat

boost::optional<Time> mLastHeartbeat
protectedinherited

◆ mStatusMap

StatusMap mStatusMap
protectedinherited

The documentation for this class was generated from the following file: