|
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 Namespace ReferencelibOrcaIce customizes Ice to simplify writing Orca components.
More...
|
Classes |
class | PostActivationCallback |
| A hook to allow something to be done post-activation. More...
|
class | Activator |
| A 'fire-and-forget' component activator. More...
|
class | Application |
| Similar to Ice::Application, plus some Orca-specifc stuff. More...
|
class | Component |
| Base class for all Components using libOrcaIce. More...
|
class | Context |
| Component's naming and networking information. More...
|
class | ConfigFileException |
| This exception is raised when something goes wrong while reading the configuration file. More...
|
class | NetworkException |
| This exception is raised when something is wrong with the network connection. More...
|
class | ComponentDeactivatingException |
class | TypeMismatchException |
| This exception is raised if the required interface type does not match the proxy type. More...
|
class | Heartbeater |
| Small utility class for keeping track of regular heartbeats. More...
|
class | Home |
| Local API to component information. More...
|
class | PtrBuffer |
| A thread-safe data pipe with buffer semantics for Ice smart pointers. More...
|
class | PtrNotify |
| A data pipe with callback semantics for Ice smart pointers. More...
|
class | PtrStore |
| Thread-safe storage for a single data object represented by an Ice smart pointer. More...
|
class | Service |
| Base class to use when putting Orca components into an IceBox. More...
|
Component Configuration Functions |
orca::FQInterfaceName | getProvidedInterface (const Context &context, const std::string &ifaceTag) |
orca::FQTopicName | getProvidedTopicWithString (const Context &context, const std::string &ifaceName, const std::string &subtopic) |
orca::FQTopicName | getProvidedTopicWithTag (const Context &context, const std::string &ifaceTag, const std::string &subtopic) |
std::string | getRequiredInterfaceAsString (const Context &context, const std::string &ifaceTag) |
std::vector< std::string > | getProvidedTags (const Context &context, const std::string &pattern) |
std::vector< std::string > | getRequiredTags (const Context &context, const std::string &pattern) |
std::string | resolveLocalPlatform (const Context &context, const std::string &proxy) |
orca::ComponentData | getComponentData (const Context &context) |
Connection Functions |
void | createInterfaceWithString (const Context &context, Ice::ObjectPtr &object, const std::string &proxyString) |
void | createInterfaceWithTag (const Context &context, Ice::ObjectPtr &object, const std::string &ifaceTag) |
std::string | getInterfaceIdWithString (const Context &context, const std::string &proxyString) |
std::string | getInterfaceIdWithTag (const Context &context, const std::string &interfaceTag) |
bool | isRegistryReachable (const Context &context) |
bool | isInterfaceReachable (const Context &context, const std::string &proxyString, std::string &diagnostic) |
template<class ConsumerProxyType> |
ConsumerProxyType | createConsumerInterface (const Context &context, Ice::ObjectPtr &consumer) |
template<class ProxyType> |
void | connectToInterfaceWithString (const Context &context, ProxyType &proxy, const std::string &proxyString) |
template<class ProxyType> |
void | connectToInterfaceWithTag (const Context &context, ProxyType &proxy, const std::string &interfaceTag) |
template<class ConsumerProxyType> |
IceStorm::TopicPrx | connectToTopicWithTag (const Context &context, ConsumerProxyType &publisher, const std::string &interfaceTag, const std::string &subtopic="*") |
template<class ConsumerProxyType> |
IceStorm::TopicPrx | connectToTopicWithString (const Context &context, ConsumerProxyType &publisher, const std::string &topicName) |
Multi-Try Connection Functions |
void | createInterfaceWithString (const Context &context, Ice::ObjectPtr &object, const std::string &name, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName, int retryInterval, int retryNumber) |
void | createInterfaceWithTag (const Context &context, Ice::ObjectPtr &object, const std::string &interfaceTag, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName, int retryInterval, int retryNumber) |
void | activate (Context &context, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName, int retryInterval, int retryNumber) |
std::string | getInterfaceIdWithString (const Context &context, const std::string &proxyString, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName, int retryInterval, int retryNumber) |
std::string | getInterfaceIdWithTag (const Context &context, const std::string &interfaceTag, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName, int retryInterval, int retryNumber) |
template<class ProxyType> |
void | connectToInterfaceWithString (const Context &context, ProxyType &proxy, const std::string &proxyString, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName="", int retryInterval=2, int retryNumber=-1) |
template<class ProxyType> |
void | connectToInterfaceWithTag (const Context &context, ProxyType &proxy, const std::string &interfaceTag, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName="", int retryInterval=2, int retryNumber=-1) |
template<class ConsumerProxyType> |
IceStorm::TopicPrx | connectToTopicWithString (const Context &context, ConsumerProxyType &publisher, const std::string &topicName, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName="", int retryInterval=2, int retryNumber=-1) |
template<class ConsumerProxyType> |
IceStorm::TopicPrx | connectToTopicWithTag (const Context &context, ConsumerProxyType &publisher, const std::string &interfaceTag, const std::string &subtopic, gbxsickacfr::gbxiceutilacfr::Thread *thread, const std::string &subsysName="", int retryInterval=2, int retryNumber=-1) |
Property functions |
std::string | getGlobalConfigFilename (const Ice::PropertiesPtr &props) |
std::string | getApplicationConfigFilename (const Ice::StringSeq &args) |
std::string | getServiceConfigFilename (const Ice::StringSeq &args) |
int | getProperty (const Ice::PropertiesPtr &prop, const ::std::string &key, std::string &value) |
std::string | getPropertyWithDefault (const Ice::PropertiesPtr &, const ::std::string &key, const std::string &defaultValue) |
| Returns the default value if key is not found.
|
int | getPropertyAsDouble (const Ice::PropertiesPtr &prop, const ::std::string &key, Ice::Double &value) |
Ice::Double | getPropertyAsDoubleWithDefault (const Ice::PropertiesPtr &prop, const ::std::string &key, Ice::Double defaultValue) |
int | getPropertyAsInt (const Ice::PropertiesPtr &prop, const ::std::string &key, int &value) |
int | getPropertyAsIntWithDefault (const Ice::PropertiesPtr &prop, const ::std::string &key, int defaultValue) |
int | getPropertyAsIntVector (const Ice::PropertiesPtr &prop, const ::std::string &key, std::vector< int > &value) |
std::vector< int > | getPropertyAsIntVectorWithDefault (const Ice::PropertiesPtr &, const ::std::string &key, const std::vector< int > &defaultValue) |
| Returns the default value if key is not found or cannot be converted to a vector<int>.
|
int | getPropertyAsDoubleVector (const Ice::PropertiesPtr &prop, const ::std::string &key, std::vector< double > &value) |
std::vector< double > | getPropertyAsDoubleVectorWithDefault (const Ice::PropertiesPtr &prop, const ::std::string &key, const std::vector< double > &defaultValue) |
std::string | warnMissingProperty (const std::string &prop) |
| Returns standardized text which warns that a configuration property is not set.
|
std::string | warnMissingPropertyWithDefault (const std::string &prop, const std::string &defaultValue) |
std::string | warnMissingProperty (const std::string &info, const std::string &prop) |
| Returns standardized text which warns that certain info is missing because a configuration property is not set.
|
std::string | warnMissingPropertyWithDefault (const std::string &info, const std::string &prop, const std::string &defaultValue) |
Stringify OCM Structures |
std::string | toString (const orca::FQComponentName &name) |
std::string | toString (const orca::FQInterfaceName &name) |
std::string | toString (const orca::FQTopicName &name) |
std::string | toString (const orca::FQExecutableName &name) |
orca::FQComponentName | toComponentName (const std::string &s) |
orca::FQInterfaceName | toInterfaceName (const std::string &s) |
std::string | toHomeIdentity (const orca::FQComponentName &fqCName) |
| Based on the component name, returns the default identity of Home interface.
|
orca::FQTopicName | toStatusTopic (const orca::FQComponentName &fqCName) |
| Based on the component name, returns the default topic name for Status interface.
|
orca::FQTopicName | toTracerTopic (const orca::FQComponentName &fqCName) |
| Based on the component name, returns the default topic name for Tracer interface.
|
Stringify Dat-Time Objects |
std::string | toStringDuration (const orca::Time &obj) |
int | toTimeDuration (const std::string &s, orca::Time &obj) |
std::string | toString (const orca::Time &obj) |
std::string | toString (const orca::TimeOfDay &) |
| Returns string in format HH:MM:SS.sss.
|
std::string | toString (const orca::Date &) |
| Returns string in format YYYY/MM/DD.
|
Time Operations |
IceUtil::Time | toIceTime (const orca::Time &t) |
| Converts from orca::Time to Ice standard time format.
|
orca::Time | toOrcaTime (const IceUtil::Time &t) |
| Converts from Ice standard time format to orca::Time.
|
orca::Time | toOrcaTime (double sec) |
orca::Time | getNow () |
| Returns current time.
|
void | setToNow (orca::Time &t) |
| Set to current time.
|
orca::TimeOfDay | toOrcaTimeOfDay (const IceUtil::Time &icetime) |
orca::Date | toOrcaDate (const IceUtil::Time &icetime) |
orca::Time | timeDiff (const orca::Time &t1, const orca::Time &t2) |
double | timeDiffAsDouble (const orca::Time &t1, const orca::Time &t2) |
double | timeAsDouble (const orca::Time &t) |
void | add (orca::Time &t, double seconds) |
| Adds the specified number of seconds to t.
|
void | subtract (orca::Time &t, double seconds) |
| Subtracts the specified number of seconds to t.
|
Enumerations |
enum | ComponentInterfaceFlag {
NoStandardInterfaces = 0x000,
HomeInterface = 0x001,
StatusInterface = 0x010,
TracerInterface = 0x100,
AllStandardInterfaces = NoStandardInterfaces | HomeInterface | StatusInterface | TracerInterface
} |
Detailed Description
libOrcaIce customizes Ice to simplify writing Orca components.
This namespace is part of a library which aims at simplifying Orca component development. It provides several helper classes to use and derive from and several functions to use. In doing so we make unavoidable assumptions about how Ice is going to be used in Orca components. If your component cannot live with these constraints you can always go back to using Ice directly (it's not much more work).
- See also:
- libOrcaIce
Enumeration Type Documentation
|
This enum type is used to describe which standard interfaces the component will provide.
Flags can be combined. For example to initialize Home and Status but not Tracer. orcaice::ComponentInterfaceFlag flag = orcaice::HomeInterface | orcaice::StatusInterface;
- Enumerator:
-
NoStandardInterfaces |
No standard interfaces. |
HomeInterface |
Home interface only. |
StatusInterface |
Status interface only. |
TracerInterface |
Tracer interface only. |
AllStandardInterfaces |
All standard interfaces. |
|
Function Documentation
void orcaice::activate |
( |
Context & |
context, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Tries to activate the adapter (by calling Context::activate(). If fails, sleeps for retryInterval [s] seconds. Will repeat until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
If a non-empty subsystem name is supplied, sends a Status heartbeat at every iteration (- See also:
- gbxsickacfr::gbxutilacfr::Status).
|
template<class ProxyType> |
void orcaice::connectToInterfaceWithString |
( |
const Context & |
context, |
|
|
ProxyType & |
proxy, |
|
|
const std::string & |
proxyString, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified remote interface until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch orcaice::NetworkException, sleep for retryInterval [s] and try again.
We do NOT catch a possible orcaice::TypeMismatchException because this condition is unlikely to change.
Example: MyInterfacePrx myInterfacePrx;
try {
orcaice::connectToInterfaceWithString<MyInterfacePrx>(
context_, myInterfacePrx, "iface@platform/component", (gbxsickacfr::gbxiceutilacfr::Thread*)this );
}
catch ( const orcaice::TypeMismatchException& e ) {
// what do we do?
}
|
template<class ProxyType> |
void orcaice::connectToInterfaceWithString |
( |
const Context & |
context, |
|
|
ProxyType & |
proxy, |
|
|
const std::string & |
proxyString |
|
) |
|
|
|
Create an Ice proxy proxy for the remote server based on a stringified proxy proxyString . The proxy can be direct or indirect. For indirect proxies with platform name set to local, hostname is used as the platform name.
Throws TypeMismatchException if fails to connect to the remote interface or if it is of the wrong type. Throws NetworkException if the interface is otherwise unreachable.
Example: to connect to interface of type MyInterface, use MyInterfacePrx myInterfacePrx;
orcaice::connectToInterfaceWithString<MyInterfacePrx>( context(), myInterfacePrx, "iface@platform/component" );
- Todo:
- Record who we connected to as a required interface so that Home can report this.
|
template<class ProxyType> |
void orcaice::connectToInterfaceWithTag |
( |
const Context & |
context, |
|
|
ProxyType & |
proxy, |
|
|
const std::string & |
interfaceTag, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified remote interface until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch orcaice::NetworkException, sleep for retryInterval [s] and try again.
We do NOT catch a possible orcaice::TypeMismatchException because this condition is unlikely to change.
We do NOT catch a possible orcaice::ConfigFileException exception.
Example: MyInterfacePrx myInterfacePrx;
try {
orcaice::connectToInterfaceWithTag<MyInterfacePrx>(
context_, myInterfacePrx, "MyInterface", (gbxsickacfr::gbxiceutilacfr::Thread*)this );
}
catch ( const orcaice::TypeMismatchException& e ) {
// what do we do?
}
catch ( const orcaice::ConfigFileException& e ) {
// what do we do?
}
|
template<class ProxyType> |
void orcaice::connectToInterfaceWithTag |
( |
const Context & |
context, |
|
|
ProxyType & |
proxy, |
|
|
const std::string & |
interfaceTag |
|
) |
|
|
|
Convenience function, behaves like connectToInterfaceWithString but the proxy information comes from the configuration file and the interfaceTag .
MyInterfacePrx myInterfacePrx;
orcaice::connectToInterfaceWithTag<MyInterfacePrx>( context(), myInterfacePrx, "MyInterface" );
Throws ConfigFileException if the interface name cannot be read for some reason. |
template<class ConsumerProxyType> |
IceStorm::TopicPrx orcaice::connectToTopicWithString |
( |
const Context & |
context, |
|
|
ConsumerProxyType & |
publisher, |
|
|
const std::string & |
topicName, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified topic by calling connectToTopicWithString() until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped If unsuccesful for any reason, an empty topic proxy is returned. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch all orcaice::NetworkException, sleep for retryInterval [s] and try again.
All other exceptions are not likely to be resolved over time so we don't catch them. |
template<class ConsumerProxyType> |
IceStorm::TopicPrx orcaice::connectToTopicWithString |
( |
const Context & |
context, |
|
|
ConsumerProxyType & |
publisher, |
|
|
const std::string & |
topicName |
|
) |
|
|
|
This function is used by potential publishers of information. It returns a proxy to the IceStorm topic and sets proxy to the topic's publisher . The publisher is used to distribute information to consumers and the topic is used to subscribe/unsubscribe data consumers.
The address of IceStorm server is looked up in the IceStorm.TopicManager.Proxy property.
Raises NetworkException if the server cannot be reached or Exception if there is any other problem. |
template<class ConsumerProxyType> |
IceStorm::TopicPrx orcaice::connectToTopicWithTag |
( |
const Context & |
context, |
|
|
ConsumerProxyType & |
publisher, |
|
|
const std::string & |
interfaceTag, |
|
|
const std::string & |
subtopic, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified topic by calling connectToTopicWithTag() until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. If unsuccesful for any reason, an empty topic proxy is returned. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch all orcaice::NetworkException, sleep for retryInterval [s] and try again.
All other exceptions are not likely to be resolved over time so we don't catch them. |
template<class ConsumerProxyType> |
IceStorm::TopicPrx orcaice::connectToTopicWithTag |
( |
const Context & |
context, |
|
|
ConsumerProxyType & |
publisher, |
|
|
const std::string & |
interfaceTag, |
|
|
const std::string & |
subtopic = "*" |
|
) |
|
|
|
Convenience function, behaves like connectToTopicWithString but the proxy information comes from the configuration file and the interfaceTag . The appropriate topic name is generated based on the fully-qualified interface name. Default subtopic is "*".
Throws ConfigFileException if the interface name cannot be read for some reason. |
template<class ConsumerProxyType> |
ConsumerProxyType orcaice::createConsumerInterface |
( |
const Context & |
context, |
|
|
Ice::ObjectPtr & |
consumer |
|
) |
|
|
|
Adds an object to the adapter and returns a direct proxy to the object. A globally unique name is supplied. This function is useful for creating 'consumer' objects, i.e. you subscribe for information to be pushed into them by specifying the direct proxy to them.
This is a local operation which does not throw any exceptions.
Ice::ObjectPtr consumer = new Odometry2dConsumerI;
orca::Odometry2dConsumerPrx consumerPrx =
orcaice::createConsumerInterface<orca::Odometry2dConsumerPrx>( context(), consumer );
|
void orcaice::createInterfaceWithString |
( |
const Context & |
context, |
|
|
Ice::ObjectPtr & |
object, |
|
|
const std::string & |
name, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to setup the specified interface until is successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch gbxsickacfr::gbxutilacfr::Exception, sleep for retryInterval [s] and try again.
Example: Ice::ObjectPtr obj = new MyObjectI;
orcaice::createInterfaceWithString( context_, obj, "coolname", (gbxsickacfr::gbxiceutilacfr::Thread*)this );
|
void orcaice::createInterfaceWithString |
( |
const Context & |
context, |
|
|
Ice::ObjectPtr & |
object, |
|
|
const std::string & |
name |
|
) |
|
|
|
Adds the object to the component adapter and gives it the name . Note that name is just the interface name, not its fully-qualified name. (In Ice terms this will become the object identity.)
Throws gbxsickacfr::gbxutilacfr::Exception if fails to register the new object.
Ice::ObjectPtr obj = new MyObjectI;
orcaice::createInterfaceWithString( context(), obj, "coolname" );
|
void orcaice::createInterfaceWithTag |
( |
const Context & |
context, |
|
|
Ice::ObjectPtr & |
object, |
|
|
const std::string & |
interfaceTag, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to setup the specified interface until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch gbxsickacfr::gbxutilacfr::Exception, sleep for retryInterval [s] and try again. Gives up after retryNumber of attempts (-1 stands for infinite number of retries).
We do NOT catch a possible orcaice::ConfigFileException exception.
Ice::ObjectPtr obj = new MyObjectI;
try
{
orcaice::createInterfaceWithTag( context_, obj, "InterfaceTag", (gbxsickacfr::gbxiceutilacfr::Thread*)this );
}
catch ( const orcaice::ConfigFileException& e ) {
// what do we do?
}
|
void orcaice::createInterfaceWithTag |
( |
const Context & |
context, |
|
|
Ice::ObjectPtr & |
object, |
|
|
const std::string & |
interfaceTag |
|
) |
|
|
|
Convenience function, behaves like createInterfaceWithString but the proxy information is looked up in the context properties based on the interfaceTag .
Throws ConfigFileException if the interface name cannot be read from the config file for some reason.
Ice::ObjectPtr obj = new MyObjectI;
orcaice::createInterfaceWithTag( context(), obj, "InterfaceTag" );
|
std::string orcaice::getApplicationConfigFilename |
( |
const Ice::StringSeq & |
args |
) |
|
|
|
Platform-independent function to find Orca component configuration file.
1. Returns the file name specified in Orca.Config configuration parameter. $ mycomponent --Orca.Config=local.cfg returns "local.cfg" 2. Returns the file name specified in Ice.Config configuration parameter. $ mycomponent --Ice.Config=local.cfg returns "local.cfg" 3. If Orca.Config is not defined (or empty), and there is only one command line argument it is assumed to be the path to the config file. $ mycomponent local.cfg returns "local.cfg" 4. File ./mycomponent.cfg when the component mycomponent is executed with no command line arguments. $ mycomponent > mycomponent.exe return "mycomponent.cfg"
Returns an empty string if everything else fails. |
|
Parses properties to build static component information. Interfaces which are not in the config file will not appear here, e.g. Home, Tracer, Status. |
std::string orcaice::getGlobalConfigFilename |
( |
const Ice::PropertiesPtr & |
props |
) |
|
|
|
Platform-independent function to find Orca global configuration file.
1. Tries to load the file specified in Orca.GlobalConfig configuration parameter. 2. If it is not defined (or empty), tries to load the file specified by the environment variable ORCAICE_GLOBAL_CONFIG 3. If it is not defined (or empty), tries to load the defaultt file from a system-dependent location: > Linux: $HOME/.orcarc > Win32: C:.ini Throws gbxsickacfr::gbxutilacfr::Exception if none of the three options work out. |
std::string orcaice::getInterfaceIdWithString |
( |
const Context & |
context, |
|
|
const std::string & |
proxyString, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified topic by calling getInterfaceIdWithString() until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. If unsuccesful for any reason, an empty string is returned. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch all orcaice::NetworkException, sleep for retryInterval [s] and try again. |
std::string orcaice::getInterfaceIdWithString |
( |
const Context & |
context, |
|
|
const std::string & |
proxyString |
|
) |
|
|
|
Tries to connect the interface described in the config file and gets its ID. Throws NetworkException if the interface is unreachable. |
std::string orcaice::getInterfaceIdWithTag |
( |
const Context & |
context, |
|
|
const std::string & |
interfaceTag, |
|
|
gbxsickacfr::gbxiceutilacfr::Thread * |
thread, |
|
|
const std::string & |
subsysName = "" , |
|
|
int |
retryInterval = 2 , |
|
|
int |
retryNumber = -1 |
|
) |
|
|
|
Convenience function. Tries to connect to the specified topic by calling getInterfaceIdWithString() until successful, the number of retries is exceeded (default -1, i.e. infinite), or the thread is stopped. If unsuccesful for any reason, an empty string is returned. Nothing is done if retryNumber=0. If a non-empty subsystem name is supplied, sends a Status heartbeat after every attempt ( - See also:
- gbxsickacfr::gbxutilacfr::Status).
We catch all orcaice::NetworkException, sleep for retryInterval [s] and try again.
All other exceptions are not likely to be resolved over time so we don't catch them. |
std::string orcaice::getInterfaceIdWithTag |
( |
const Context & |
context, |
|
|
const std::string & |
interfaceTag |
|
) |
|
|
|
Tries to connect the interface described in the config file and gets its ID. Throws NetworkException if the interface is unreachable. Throws ConfigFileException if there's a problem with reading from the config file. |
int orcaice::getProperty |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
std::string & |
value |
|
) |
|
|
|
Returns: 0 = property found (and its value is not empty), non-zero = property not found (or is defined but left empty). Note that the Ice PropertiesI::load() method has a line size limitation of 1024 characters but quietly fails so there is no way of knowing if you have exceeded this limitation |
int orcaice::getPropertyAsDouble |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
Ice::Double & |
value |
|
) |
|
|
|
Returns: 0 = property found (and its value is not empty), non-zero = property not found (or is defined but left empty). Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int orcaice::getPropertyAsDoubleVector |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
std::vector< double > & |
value |
|
) |
|
|
|
Parses the value into a vector of doubles assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and its value is not empty), non-zero = property not found (or is defined but left empty). Note that the Ice PropertiesI::load() method has a line size limitation of 1024 characters but quietly fails so there is no way of knowing if you have exceeded this limitation. Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
std::vector< double > orcaice::getPropertyAsDoubleVectorWithDefault |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
const std::vector< double > & |
defaultValue |
|
) |
|
|
|
Returns the default value if key is not found. Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
Ice::Double orcaice::getPropertyAsDoubleWithDefault |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
const Ice::Double |
defaultValue |
|
) |
|
|
|
Returns the default value if key is not found. Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int orcaice::getPropertyAsInt |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
int & |
value |
|
) |
|
|
|
Returns: 0 = property found (and its value is not empty), non-zero = property not found (or is defined but left empty). Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int orcaice::getPropertyAsIntVector |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
std::vector< int > & |
value |
|
) |
|
|
|
Parses the value into a vector of ints assuming empty space delimeters. Elements will continue to be added to the end of the vector until the end of the line is reached. Returns: 0 = property found (and its value is not empty), non-zero = property not found (or is defined but left empty). Note that the Ice PropertiesI::load() method has a line size limitation of 1024 characters. but quietly fails so there is no way of knowing if you have exceeded this limitation Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
int orcaice::getPropertyAsIntWithDefault |
( |
const Ice::PropertiesPtr & |
, |
|
|
const ::std::string & |
key, |
|
|
const int |
defaultValue |
|
) |
|
|
|
Returns the default value if key is not found. Throws a gbxsickacfr::gbxutilacfr::Exception if the key is found but the value cannot be converted to the desired type. |
orca::FQInterfaceName orcaice::getProvidedInterface |
( |
const Context & |
, |
|
|
const std::string & |
interfaceTag |
|
) |
|
|
|
Reads properties contained in the context and returns the fully-qualified name of the provided interface corresponding to interfaceTag.
Throws ConfigFileException if the interface name cannot be read for some reason. |
std::vector< std::string > orcaice::getProvidedTags |
( |
const Context & |
context, |
|
|
const std::string & |
pattern = "" |
|
) |
|
|
|
For components with variable number of interfaces it may be useful to get a listing of all provided interfaces described in the configuration file.
See getRequiredTags() for the usage of pattern . |
orca::FQTopicName orcaice::getProvidedTopicWithString |
( |
const Context & |
, |
|
|
const std::string & |
interfaceName, |
|
|
const std::string & |
subtopic = "*" |
|
) |
|
|
|
Reads platform and component names from the context, and the interface name and returns the fully-qualified topic name, and the optional subtopic name. We don't check if the interfaceName is empty. |
orca::FQTopicName orcaice::getProvidedTopicWithTag |
( |
const Context & |
, |
|
|
const std::string & |
interfaceTag, |
|
|
const std::string & |
subtopic = "*" |
|
) |
|
|
std::string orcaice::getRequiredInterfaceAsString |
( |
const Context & |
, |
|
|
const std::string & |
interfaceTag |
|
) |
|
|
|
Reads properties contained in the context and returns the stringified proxy to the required interface corresponding to the interface tag.
The proxy can be direct or indirect.
Throws ConfigFileException if the interface name cannot be read for some reason. |
std::vector< std::string > orcaice::getRequiredTags |
( |
const Context & |
context, |
|
|
const std::string & |
pattern = "" |
|
) |
|
|
|
For components with variable number of interfaces it may be useful to get a listing of all required interfaces described in the configuration file.
You may have a group of permanent required interfaces and group of variable or optional ones. To separate the two groups you may want to start all optional tags with a certain pattern. For example, your config file may look like this: MyComponent.Requires.Locolise2d.Proxy=something
MyComponent.Requires.LaserScanner2dFront.Proxy=something
MyComponent.Requires.LaserScanner2dBack.Proxy=something
In this case you would get a list of "laser" required interfaces by supplying the pattern="LaserScanner2d" or pattern="Laser" or pattern="La". For example: std::vector<std::string> laserTags;
laserTags = orcaice::getRequiredTags( context_, "Laser" );
The default empty string pattern will match all required interfaces. |
std::string orcaice::getServiceConfigFilename |
( |
const Ice::StringSeq & |
args |
) |
|
|
|
Platform-independent function to find Orca component configuration file.
1. Returns the file name specified in Orca.Config configuration parameter. IceBox.Service.MyService=MyService:create --Orca.Config=local.cfg returns "local.cfg"
2. Returns the file name specified in Ice.Config configuration parameter. IceBox.Service.MyService=MyService:create --Ice.Config=local.cfg returns "local.cfg"
Throws gbxsickacfr::gbxutilacfr::Exception if the argument list is empty. Returns an empty string if the argument is non-empty but no suitable properties were found. |
bool orcaice::isInterfaceReachable |
( |
const Context & |
context, |
|
|
const std::string & |
proxyString, |
|
|
std::string & |
diagnostic |
|
) |
|
|
|
Tries to reach the remote interface specified with proxyString by calling ice_ping() function. Returns TRUE if the ping was successful and FALSE if not. Writes diagnostic information into diagnostic string.
Catches all exceptions. Does not throw.
Implementation note: this function does not need to be templated because ice_ping() is implemented by all Ice objects regardless of type. |
bool orcaice::isRegistryReachable |
( |
const Context & |
context |
) |
|
|
|
Tries to ping the default Locator and, based on success or the exceptions it catches, determines if the registry is reachable. |
std::string orcaice::resolveLocalPlatform |
( |
const Context & |
context, |
|
|
const std::string & |
proxy |
|
) |
|
|
|
For indirect proxies with platform name set to local, returns a new proxy string with local replaced with the current hostname. |
double orcaice::timeAsDouble |
( |
const orca::Time & |
t |
) |
|
|
|
Converts an orca::Time to a double in seconds. Time can be negative, but remember that seconds and microseconds are added to together. e.g. -10s:-100000us and -11s:900000us will both translate to -10.1s |
|
Returns the difference between two time values (ie: t1-t2) The result is negative if t1 is earlier than t2. |
|
Returns the difference between two time values as a double (in seconds) (ie: t1-t2) The result is negative if t1 is earlier than t2. |
|
Parses a string to extract a fully qualified component name (aka Adapter ID) Expects an input string in the form of platform/component A null structure is returned if no delimeter is present. Does not handle the case of multiple delimeters. |
|
Parses a string to extract a fully qualified interface name Expects an input string in the form of interface /component A null structure is returned if either one of the delimeters is absent. |
orca::Date orcaice::toOrcaDate |
( |
const IceUtil::Time & |
t |
) |
|
|
|
Converts from Ice standard time format to orca::Date. Unlike IceUtil::Time::toDateTime(), we use UTC time and not local time. |
|
Converts from number of seconds to orca::Time. Time can be negative, in which case both seconds and microseconds are returned as negatives, e.g. -10.1s will translate to -10s:-100000us, not -11s:900000us. |
orca::Time orcaice::toOrcaTime |
( |
const IceUtil::Time & |
icetime |
) |
|
|
|
Converts from Ice standard time format to orca::Time.
- Todo:
- are these casts ok?
|
|
Converts from Ice standard time format to orca::TimeOfDay. Unlike IceUtil::Time::toDateTime(), we use UTC time and not local time. |
std::string orcaice::toString |
( |
const orca::Time & |
|
) |
|
|
|
Returns string in human readable format: MM/DD/YY HH:MM:SS.sss. |
|
Converts fully executable name to a string. i.e. executable |
|
Converts fully qualified topic name to a string. i.e. interface/topic@platform/component |
|
Converts fully qualified interface name to a string. e.i. interface@platform/component - See also:
- toInterfaceName
|
|
Converts fully qualified component name (aka Adapter ID) to a string. e.i. platform/component - See also:
- toComponentName
|
std::string orcaice::toStringDuration |
( |
const orca::Time & |
|
) |
|
|
|
For durations less than 24hrs returns string HH:MM:SS.sss. Otherwise, DD:HH:MM:SS.sss Negative times are supported but only if seconds and microseconds are both negative. |
int orcaice::toTimeDuration |
( |
const std::string & |
, |
|
|
orca::Time & |
|
|
) |
|
|
|
Parses result of the correspondinng toString(). Returns: 0 = parsing successful, non-zero = parsing failed. Negative durations are supported, but only if the very first character of the string is '-'. |
std::string orcaice::warnMissingPropertyWithDefault |
( |
const std::string & |
info, |
|
|
const std::string & |
prop, |
|
|
const std::string & |
defaultValue |
|
) |
|
|
|
Returns standardized text which warns that a property is missing because a configuration property is not set. Also informs that the specified default value is used instead. |
std::string orcaice::warnMissingPropertyWithDefault |
( |
const std::string & |
prop, |
|
|
const std::string & |
defaultValue |
|
) |
|
|
|
Returns standardized text which warns that a configuration property is not set. Also informs that the specified default value is used instead. |
|
|