|
orca-robotics

INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications
REPOSITORY
Interfaces
Components
Libraries
Utilities
Software Map
DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
Wiki
login/pass: orca/orca
PEOPLE
Contributors
Users

Project
Download
Mailing lists
|
|
|
orcaice::Component Class ReferenceBase class for all Components using libOrcaIce.
More...
#include <component.h>
Inherits hydroutil::Uncopyable.
Inherited by Component, orcaview2d::Component, orcaview3d::Component, probe::Component, registryview::Component, robot2d::Component, segwayrmp::Component, sysmon::Component, teleop::Component, TestComponent, TestComponent, TestComponent, TestComponent, TestComponent, TestComponent, TestComponent, TestComponent, TestComponent, and tracermon::Component.
Inheritance diagram for orcaice::Component:
[legend]List of all members.
Detailed Description
Base class for all Components using libOrcaIce.
Deriving from this makes it easy to use code as either a stand-alone application (using orcaice::Application) or as a service in an IceBox (using orcaice::Service). Two functions must be implemented: start and stop.
Most of the state of the component is summarized in its Component::context. The information is read-only because it is set prior to the component's initialization.
- Component Initialisation
Component initialisation code can be put in two places:
1. Component Constructor
- In the constructor, none of the orcaice machinery is initialised. This means that no remote calls can be made (the communicator isn't initialised yet), and the tracer isn't available yet.
- Any code that should be executed before any remote calls are made belongs in the Component constructor.
2. Component::start()
- start() is called after all resources in Context are initialised.
- Home and Status interfaces are initialized from a separate thread and it it may take multiple attempts to do this.
- This is the place to launch threads from.
- Don't do anything that might loop forever in here, otherwise it won't be possible to bring the component down cleanly.
- Component Destruction
Clean-up code belongs in one of two places:
1. Component::stop()
- The context and communicator are still available at this point
2. Component Destructor
- The context and communicator are no longer available
- Author:
- Alex Brooks, Alexei Makarenko
- See also:
- Application, Service, Context
Tracer, Status
Constructor & Destructor Documentation
|
Takes the text tag with which to identify it in the config files. The flag ! specifies what standard interfaces to initialize. It is also possible to configure ! standard interfaces with configuration parameters. Configuration parameters always ! override the values supplied with ComponentInterfaceFlag. Orca.Component.EnableTracer
Orca.Component.EnableStatus
Orca.Component.EnableHome
! ! Inside this contructor the component context is not initialized yet and cannot be used. |
Member Function Documentation
void Component::activate |
( |
|
) |
[protected] |
|
|
Activates the component's adapter. Activation makes provided interfaces accessible from the outside world. It also tries to register the adapter with the IceGrid Registry. If the registry is unreachable, the adapter is not fully activated.
An Orca configuration property Orca.RequireRegistry determines what happens if the Registry is not available. If RequireRegistry=1 (default) and the registry is unreachable, an orcaice::NetworkException is thrown. In this case it is safe to call activate again later, hoping that the regisry will become reachable. If RequireRegistry=0 no exception is thrown. |
const Context& orcaice::Component::context |
( |
|
) |
const [inline, protected] |
|
|
Component's "context", which contains component's naming and networking information. It can be used directly or passed to threads and classes. For example: context().tracer().info("Everything is OK");
MainLoop myloop( context() );
|
const std::string Component::help |
( |
const std::string & |
executable |
) |
const [virtual] |
|
|
This function is called by Application when the executable is called with --help command line option. |
virtual void orcaice::Component::start |
( |
|
) |
[pure virtual] |
|
|
This function is called by the component's container (Application or Service). It should return immediately, possibly after launching a thread. GUI components are an exception to this rule, they may run in the calling thread provided that the Ctrl-C handler was not installed (see Application, Service). |
virtual void orcaice::Component::stop |
( |
|
) |
[pure virtual] |
|
|
This function is called by the component's container (Application or Service) when the component is ordered to stop execution. |
virtual const std::string orcaice::Component::version |
( |
|
) |
const [inline, virtual] |
|
|
This function is called by Application on startup (including when the executable is ! called with --version command line option). Standard Orca components return an ! empty string. Component from external project may reimplement this function to supply ! the project version, which is probably different from the Orca version. ! Example: virtual const std::string version() const { return std::string(PROJECT_VERSION); };
! Note that PROJECT_VERSION is defined automatically for all projects. |
The documentation for this class was generated from the following files:
|
|