|
INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications
NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities
FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities
Full Software Listings
DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
PEOPLE
Contributors
Users
Project
Download
Mailing lists
|
|
|
hydroiceutil Namespace Reference
libHydroUtil customizes libIceUtil to simplify writing Orca components.
More...
Classes |
class | Event |
class | EventReceiver |
| A class which lets outsiders to post events into its own event queue. More...
|
class | EventJob |
class | ReceiverIdNotExistException |
| This exception is raised when something is wrong with the hardware. More...
|
class | EventLoop |
class | EventQueue |
| Thread-safe event queue. More...
|
class | EventQueueHolder |
| A class which lets outsiders to post events into its own event queue. More...
|
class | EventScheduler |
class | Job |
struct | JobQueueStatus |
| Current status of the job queue. More...
|
class | JobQueue |
| A queue of jobs to be processed. More...
|
class | LocalHistory |
| Writes component's run history to a local file. More...
|
class | LocalStatus |
class | LocalTracer |
| Full-featured local tracing. More...
|
class | SimpleTracer |
| Simple local tracing. More...
|
class | SubsystemThread |
| A class implementing the common subsystem state machine, also catches all. More...
|
Typedefs |
typedef IceUtil::Handle< Event > | EventPtr |
| Smart pointer to Event.
|
typedef IceUtil::Handle< EventJob > | EventJobPtr |
| Ice smart pointer to the EventJob.
|
typedef IceUtil::Handle
< EventLoop > | EventLoopPtr |
| Ice smart pointer to EventLoop.
|
typedef IceUtil::Handle
< EventQueueOptimizer > | EventQueueOptimizerPtr |
| Smart pointer to EventQueueOptimizer.
|
typedef IceUtil::Handle
< EventQueue > | EventQueuePtr |
| Smart pointer to EventQueue.
|
typedef IceUtil::Handle
< EventQueueHolder > | EventQueueHolderPtr |
| Smart pointer to EventQueueHolder.
|
typedef IceUtil::Handle
< EventScheduler > | EventSchedulerPtr |
| Ice smart pointer to EventScheduler.
|
typedef IceUtil::Handle< Job > | JobPtr |
| Ice smart pointer to job.
|
typedef IceUtil::Handle< JobQueue > | JobQueuePtr |
| Ice smart pointer to job queue.
|
typedef IceUtil::Handle
< SubsystemThread > | SubsystemThreadPtr |
| A smart pointer to the SubsystemThread class.
|
Functions |
std::string | catchExceptions (gbxutilacfr::Tracer &tracer, const std::string &activity) |
std::string | catchExceptionsWithSleep (gbxutilacfr::Tracer &tracer, const std::string &activity, int sleepIntervalMSec) |
std::string | catchExceptionsWithStatus (const std::string &activity, gbxutilacfr::SubHealth &subHealth, gbxutilacfr::SubsystemHealth newHealth) |
std::string | catchExceptionsWithStatusAndSleep (const std::string &activity, gbxutilacfr::SubHealth &subHealth, gbxutilacfr::SubsystemHealth newHealth, int sleepIntervalMSec) |
|
|
void | now (int &seconds, int &useconds) |
| Current time in seconds and microseconds.
|
void | timeFromIceUtil (const IceUtil::Time &time, int &seconds, int &useconds) |
| Converts time in IceUtil format to seconds and microseconds.
|
std::string | toDuration (const IceUtil::Time &t, const std::string &separator) |
void | timeFromDouble (double time, int &seconds, int &useconds) |
IceUtil::Time | timeFromDouble (double time) |
| Convenience function, works as the one above.
|
double | timeAsDouble (int seconds, int useconds) |
Detailed Description
libHydroUtil customizes libIceUtil to simplify writing Orca components.
This namespace is part of a library which aims at simplifying Orca component development.
- See also:
- libHydroIceUtil
Function Documentation
std::string hydroiceutil::catchExceptions |
( |
gbxutilacfr::Tracer & |
tracer, |
|
|
const std::string & |
activity = "" | |
|
) |
| | |
Catches the following types results in status fault: {std::exception, std::string, char*, "..."}.
Do not call this function outside of a catch block! In this case, there will be no exception to re-throw and terminate() will be called, resulting in abort().
Returns problem description.
Example:
try
{
// do something
}
catch ( ... )
{
hydroiceutil::catchExceptions( context_.tracer(), "initializing hardware driver" );
}
std::string hydroiceutil::catchExceptionsWithSleep |
( |
gbxutilacfr::Tracer & |
tracer, |
|
|
const std::string & |
activity, |
|
|
int |
sleepIntervalMSec = 1000 | |
|
) |
| | |
Same as catchExceptions() but also sleeps for specified number of milliseconds before returning. Use this function to slow execution down in case of a persistent error. Default sleep interval is 1000ms.
Example:
while ( !isStopping() )
{
try
{
// do something
}
catch ( ... )
{
hydroiceutil::catchExceptionsWithSleep( context_.tracer(), "initializing hardware driver", 2000 );
// possibly do something else, e.g. re-initialize your hardware driver
}
}
std::string hydroiceutil::catchExceptionsWithStatus |
( |
const std::string & |
activity, |
|
|
gbxutilacfr::SubHealth & |
subHealth, |
|
|
gbxutilacfr::SubsystemHealth |
newHealth = gbxutilacfr::SubsystemFault | |
|
) |
| | |
Same as catchExceptions() but also changes subsystem's health to newHealth. All status health types are allowed. Default new health is gbxutilacfr::SubsystemFault.
Example:
while ( !isStopping() )
{
try
{
// do something
}
catch ( ... )
{
// will issue a status Warning instead of the default Fault.
hydroiceutil::catchExceptionsWithSleep( "initializing hardware driver", health(), gbxutilacfr::SubsystemWarning );
}
}
std::string hydroiceutil::catchExceptionsWithStatusAndSleep |
( |
const std::string & |
activity, |
|
|
gbxutilacfr::SubHealth & |
subHealth, |
|
|
gbxutilacfr::SubsystemHealth |
newHealth = gbxutilacfr::SubsystemFault , |
|
|
int |
sleepIntervalMSec = 1000 | |
|
) |
| | |
Same as catchExceptionsWithStatus() but also sleeps for specified number of milliseconds before returning. Use this function to slow execution down in case of a persistent error.
This function is normally called from inside the catch block of the component's main loop, i.e. inside SubsystemThread::run() function.
Example:
while ( !isStopping() )
{
try
{
// do your stuff
}
catch ( ... )
{
hydroiceutil::catchExceptionsWithStatusAndSleep( "initializing hardware driver", health() );
}
}
double hydroiceutil::timeAsDouble |
( |
int |
seconds, |
|
|
int |
useconds | |
|
) |
| | |
Converts time in seconds and microseconds 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
void hydroiceutil::timeFromDouble |
( |
double |
time, |
|
|
int & |
seconds, |
|
|
int & |
useconds | |
|
) |
| | |
Converts from number of seconds to seconds and microseconds. 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.
Referenced by hydroiceutil::EventScheduler::scheduleEvent().
std::string hydroiceutil::toDuration |
( |
const IceUtil::Time & |
time, |
|
|
const std::string & |
separator = ":" | |
|
) |
| | |
Returns a string with time duration in the following format (with default separator): "D:H:M:S.sss" Numeric values are not padded, i.e. 5min appears as 5 (not 05). Separator string can be specified.
E.g. "0 0 58 12.232"
|
|