Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Utilities


Namespaces

namespace  IDEA
namespace  IDEA

Compounds

class  CommandLineArguments
 Wrapper to maintain the command-line arguments and make them accessable throughout the process. More...

class  CommandLineParser
 Base class for command-line parsing. One can extend the class and use registerOption to add command-line options and implement parseInternal (or use getOption) to retrieve the options. More...

class  Factory
 Factory base class. More...

class  Guard
 This data structure is meant to be used within a method or function. It performs automatic aquisition and release of a parameterized synchronization object <LOCK>. More...

class  LockTrace
 The (ACE) singleton class LockTrace traces the locking and unlocking of mutexes. Tracing the locking can be turned of by defining the identifier TRACE_LOCKS. TRACE_LOCKS can be defined with a -D command-line option for the compiler or with a define directive. More...

class  Singleton
 This template class pattern provides a traditional Singleton pattern (see GoF). Allows you to designate a single-instance global class by inheriting off of the template class. More...

class  ThreadNames
 Singleton class for threads to map a thread to a string for tracing purposes. More...

class  ThreadNames
 Singleton class for threads to map a thread to a string for tracing purposes. More...

class  Time
 Internal IDEA time representation. More...

class  TimeParser
 Used to convert human readable local time to Epoch time and vice versa. More...

class  TokenLocation
 Location of a token consisting out of the agent-name, object-class-name and attribute-name. More...

class  Trace
 Output management class. More...


Defines

#define CT_READ_DATE_FORMAT   "%Y %b %d %H:%M:%S"
 Date and time format.

#define CT_DATE_FORMAT   "%Z " CT_READ_DATE_FORMAT
 Timezone, date and time format.

#define LOCK_OUTPUT   IDEA::Guard< IDEA::RecursiveThreadMutex > guard( IDEA::Trace::instance()->getMutex(), "TraceLock");
 Creates a guard the mutex of the global unique Trace instance.

#define IDEA_TRACE(msg)
 A macro to stream a message msg to output stream stream with a timestamp. Will lock a mutex to make it thread safe.

#define IDEA_TRACE_NO_TIME_STAMP(msg)
 A macro to stream a message msg to output stream stream without a timestamp. Will lock a mutex to make it thread safe.

#define DEBUG_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::DEBUG );
 Turns the output level to DEBUG.

#define HIGH_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::HIGH );
 Turns the output level to HIGH.

#define MEDIUM_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::MEDIUM );
 Turns the output level to MEDIUM.

#define LOW_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::LOW );
 Turns the output level to LOW.

#define DEBUG_TRACE(msg)   if( IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE( msg );
 Will stream msg to the Trace::getStream if output level is DEBUG.

#define HIGH_TRACE(msg)   if( IDEA::Trace::instance()->isOutputLevelHigh() || IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE( msg );
 Will stream msg to the Trace::getStream if output level is at least HIGH.

#define MEDIUM_TRACE(msg)   if( !IDEA::Trace::instance()->isOutputLevelLow() ) IDEA_TRACE( msg );
 Will stream msg to the Trace::getStream if output level is at least MEDIUM.

#define LOW_TRACE(msg)   IDEA_TRACE( msg )
 Will stream msg to the Trace::getStream if output level is at least LOW.

#define DEBUG_TRACE_NO_TIME_STAMP(msg)   if( IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 Will stream msg to the Trace::getStream without a timestamp if output level is DEBUG.

#define HIGH_TRACE_NO_TIME_STAMP(msg)   if( IDEA::Trace::instance()->isOutputLevelHigh() || IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 Will stream msg to the Trace::getStream without a timestamp if output level is at least HIGH.

#define MEDIUM_TRACE_NO_TIME_STAMP(msg)   if( !IDEA::Trace::instance()->isOutputLevelLow() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 Will stream msg to the Trace::getStream without a timestamp if output level is at least MEDIUM.

#define LOW_TRACE_NO_TIME_STAMP(msg)   IDEA_TRACE_NO_TIME_STAMP( msg )
 Will stream msg to the Trace::getStream without a timestamp if output level is at least LOW.

#define DET_TRACE(msg)   MEDIUM_TRACE( msg )
 Will stream msg to the Trace::getStream if output level is at least MEDIUM.

#define DET_TRACE_NO_TIME_STAMP(msg)   MEDIUM_TRACE_NO_TIME_STAMP( msg )
 Will stream msg to the Trace::getStream without a timestamp if output level is at least MEDIUM.

#define trace(msg)   LOW_TRACE( msg )
 Will stream msg to the Trace::getStream if output level is at least LOW.

#define trace_no_time_stamp(msg)   LOW_TRACE_NO_TIME_STAMP( msg )
 Will stream msg to the Trace::getStream eithout a timestamp if output level is at least LOW.


Typedefs

typedef ACE_Thread_Mutex ThreadMutex
 Datastructure for locking threads.

typedef ACE_Recursive_Thread_Mutex RecursiveThreadMutex
 Datastructure for locking threads recursively that are in the same thread.

typedef ACE_Process_Mutex ProcessMutex
 Datastructure for locking threads that are in the same process.

typedef ACE_Thread_Semaphore ThreadSemaphore
 Datastructure for a thread semaphore.

typedef ACE_Process_Semaphore ProcessSemaphore
 Datastructure for a process semaphore.

typedef timeval ideaTimeVal
 Introduced to resolve namespace clashes.

typedef std::list< std::string > StringList
 STL list of type std::string.

typedef std::set< std::string > StringSet
 STL set of type std::string.

typedef std::vector< std::string > StringVector
 STL vector of type std::string.

typedef std::list< int > IntList
 STL list of type int.

typedef std::vector< int > IntVector
 STL vector of type int.

typedef std::set< int > IntSet
 STL set of type int.

typedef std::list< double > DoubleList
 STL list of type double.


Enumerations

enum  StatusType {
  OK = 0, command_line_err, underspec_flaw, returnValue_flaw,
  markTokensStarted_flaw, finalizeTokens_flaw, refineTimes_flaw, controllerTimeout_err,
  plannerTimeout_err, plannerExhausted_err, timer_err, internal_err,
  propagation_err, timeline_gap_err, timeline_end_err, ace_err,
  deliberation_complete, deliberation_incomplete, deliberation_failure, mutex_failure,
  aborted, unknown_status
}
 Type to indicate the state of system. More...

enum  Granularity {
  SECONDS = 0, DECI_SECONDS = 1, CENTI_SECONDS = 2, MILLI_SECONDS = 3,
  MICRO_SECONDS = 6, NANO_SECONDS = 9
}
 Type for granulity of time representation in the XIDDL model, see Agent Latency and Time Units. More...


Functions

bool loadModules (const std::string &fileName)
 Takes module configuration file fileName and will load all the modules defined in the file. Will return true if all modules can be loaded succesfully otherwise returns false.

template<class LOCK> void acquire (LOCK &lock, const std::string &locator)
 Function to acquire a lock on the LOCK.

template<class LOCK> void release (LOCK &lock, const std::string &locator)
 Function to release a lock on the LOCK.

std::ostream & operator<< (std::ostream &os, const IntSet &is)
 Streams the container in human readable format to os.

std::ostream & operator<< (std::ostream &os, const StringSet &ss)
 Streams the container in human readable format to os.

std::ostream & operator<< (std::ostream &os, const StringList &ss)
 Streams the container in human readable format to os.

std::ostream & operator<< (std::ostream &os, const StringVector &ss)
 Streams the container in human readable format to os.

void * loadSharedLibrary (const std::string &fileName)
 Loads the shared library fileName.

template<class Type> std::string toString (Type &t)
 Converts a value of type Type to a string.

template<> std::string toString (double &t)
 Template specialization of toString for type double. It sets the precision to 12.

template<> std::string toString (bool &t)
 Template specialization of toString for type bool. Puts bool values in alphabetic format.

template<> std::string toString (StatusType &t)
 Template specialization of toString for type StatusType. Converts the status type to a human understandable string.

template<class Type> Type toValue (const std::string &st)
 Template specialization for type bool of toValue.

bool toBool (const std::string &st)
bool readPlannerArg (std::string &arglist, std::string &arg)
 Takes a comma deliminated string argList and will populate arg with the first field if any and will remove this field from arglist. If no first field exists the function will return false otherwise it will return true.

void removeTrailingBlanks (std::string &text)
 Takes a string \text and will remove any white spaces at the back of the string.

void removeLeadingBlanks (std::string &text)
 Takes a string \text and will remove any white spaces at the front of the string.

bool findString (const std::string &text, const char *pattern)
 Returns true if pattern can be found in text. Otherwise returns false.

bool findLeadingString (const std::string &text, const char *pattern)
 Returns true if text starts with pattern otherwise returns false.

bool doesFileExist (const std::string &name)
 Returns true if the file name exists, otherwise returns false.

char * copyString (const char *str)
 Copies str and returns the copy.

template<class Type> std::string toString (Type &t)

Variables

std::string UNKNOWN = "UNKNOWN"
 Variable to identify an unknown value.


Define Documentation

#define CT_DATE_FORMAT   "%Z " CT_READ_DATE_FORMAT
 

Timezone, date and time format.

#define CT_READ_DATE_FORMAT   "%Y %b %d %H:%M:%S"
 

Date and time format.

#define DEBUG_TRACE msg       if( IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE( msg );
 

Will stream msg to the Trace::getStream if output level is DEBUG.

#define DEBUG_TRACE_NO_TIME_STAMP msg       if( IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 

Will stream msg to the Trace::getStream without a timestamp if output level is DEBUG.

#define DEBUG_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::DEBUG );
 

Turns the output level to DEBUG.

#define DET_TRACE msg       MEDIUM_TRACE( msg )
 

Will stream msg to the Trace::getStream if output level is at least MEDIUM.

Deprecated:
Use MEDIUM_TRACE instead of DET_TRACE

#define DET_TRACE_NO_TIME_STAMP msg       MEDIUM_TRACE_NO_TIME_STAMP( msg )
 

Will stream msg to the Trace::getStream without a timestamp if output level is at least MEDIUM.

Deprecated:
Use MEDIUM_TRACE_NO_TIME_STAMP instead of DET_TRACE_NO_TIME_STAMP

#define HIGH_TRACE msg       if( IDEA::Trace::instance()->isOutputLevelHigh() || IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE( msg );
 

Will stream msg to the Trace::getStream if output level is at least HIGH.

#define HIGH_TRACE_NO_TIME_STAMP msg       if( IDEA::Trace::instance()->isOutputLevelHigh() || IDEA::Trace::instance()->isOutputLevelDebug() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 

Will stream msg to the Trace::getStream without a timestamp if output level is at least HIGH.

#define HIGH_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::HIGH );
 

Turns the output level to HIGH.

#define IDEA_TRACE msg   
 

Value:

{ \
   LOCK_OUTPUT; \
   IDEA::Trace::instance()->getStream() << "[ " << IDEA::getAgentName().c_str() << " " \
                 << IDEA::ThreadNames::instance()->getName() << " " \
                 << IDEA::getElapsedTime() << " " \
                 << IDEA::getCurrentTime() << " " \
                 << IDEA::getCurrentTick() << " ] " \
                 << msg << std::endl; \
  }
A macro to stream a message msg to output stream stream with a timestamp. Will lock a mutex to make it thread safe.

#define IDEA_TRACE_NO_TIME_STAMP msg   
 

Value:

{ \
   LOCK_OUTPUT; \
   IDEA::Trace::instance()->getStream() << msg << std::endl; \
 }
A macro to stream a message msg to output stream stream without a timestamp. Will lock a mutex to make it thread safe.

#define LOCK_OUTPUT   IDEA::Guard< IDEA::RecursiveThreadMutex > guard( IDEA::Trace::instance()->getMutex(), "TraceLock");
 

Creates a guard the mutex of the global unique Trace instance.

#define LOW_TRACE msg       IDEA_TRACE( msg )
 

Will stream msg to the Trace::getStream if output level is at least LOW.

#define LOW_TRACE_NO_TIME_STAMP msg       IDEA_TRACE_NO_TIME_STAMP( msg )
 

Will stream msg to the Trace::getStream without a timestamp if output level is at least LOW.

#define LOW_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::LOW );
 

Turns the output level to LOW.

#define MEDIUM_TRACE msg       if( !IDEA::Trace::instance()->isOutputLevelLow() ) IDEA_TRACE( msg );
 

Will stream msg to the Trace::getStream if output level is at least MEDIUM.

#define MEDIUM_TRACE_NO_TIME_STAMP msg       if( !IDEA::Trace::instance()->isOutputLevelLow() ) IDEA_TRACE_NO_TIME_STAMP( msg );
 

Will stream msg to the Trace::getStream without a timestamp if output level is at least MEDIUM.

#define MEDIUM_TRACE_ON   IDEA::Trace::instance()->setOutputLevel( IDEA::Trace::MEDIUM );
 

Turns the output level to MEDIUM.

#define trace msg       LOW_TRACE( msg )
 

Will stream msg to the Trace::getStream if output level is at least LOW.

Deprecated:
Use LOW_TRACE instead of trace

#define trace_no_time_stamp msg       LOW_TRACE_NO_TIME_STAMP( msg )
 

Will stream msg to the Trace::getStream eithout a timestamp if output level is at least LOW.

Deprecated:
Use LOW_TRACE_NO_TIME_STAMP instead of trace


Typedef Documentation

typedef std::list< double > IDEA::DoubleList
 

STL list of type double.

typedef struct timeval IDEA::ideaTimeVal
 

Introduced to resolve namespace clashes.

typedef std::list< int > IDEA::IntList
 

STL list of type int.

typedef std::set< int > IDEA::IntSet
 

STL set of type int.

typedef std::vector< int > IDEA::IntVector
 

STL vector of type int.

typedef ACE_Process_Mutex IDEA::ProcessMutex
 

Datastructure for locking threads that are in the same process.

typedef ACE_Process_Semaphore IDEA::ProcessSemaphore
 

Datastructure for a process semaphore.

typedef ACE_Recursive_Thread_Mutex IDEA::RecursiveThreadMutex
 

Datastructure for locking threads recursively that are in the same thread.

typedef std::list< std::string > IDEA::StringList
 

STL list of type std::string.

typedef std::set< std::string > IDEA::StringSet
 

STL set of type std::string.

typedef std::vector< std::string > IDEA::StringVector
 

STL vector of type std::string.

typedef ACE_Thread_Mutex IDEA::ThreadMutex
 

Datastructure for locking threads.

typedef ACE_Thread_Semaphore IDEA::ThreadSemaphore
 

Datastructure for a thread semaphore.


Enumeration Type Documentation

enum IDEA::Granularity
 

Type for granulity of time representation in the XIDDL model, see Agent Latency and Time Units.

Enumeration values:
SECONDS  1 sec. = 1 sec.
DECI_SECONDS  1 sec. = 10 deci sec.
CENTI_SECONDS  1 sec. = 100 centi sec.
MILLI_SECONDS  1 sec. = 1000 milli sec.
MICRO_SECONDS  1 sec. = 100000 micro. sec.
NANO_SECONDS  1 sec. = 1000000000 nano sec.

enum IDEA::StatusType
 

Type to indicate the state of system.

Used as a return type for planners.

Todo:
Clean up these codes, they are no longer being used in the correct way at the correct spot
Enumeration values:
OK 
command_line_err 
underspec_flaw 
returnValue_flaw 
markTokensStarted_flaw 
finalizeTokens_flaw 
refineTimes_flaw 
controllerTimeout_err  The reactive planner needs more time than we give it
plannerTimeout_err  The reactive planner needs more time than we give it
plannerExhausted_err  The planner ran out of decisions and we do not have a plan
timer_err  Some error occured in the timer mechanism
internal_err  Some internal error occured
propagation_err  Some propagation error occured
timeline_gap_err  There is a gap in a timeline (the end of a token is not constraind to be equal to the start of the succeeding token
timeline_end_err 
ace_err  Some error happened in a ACE invocation
deliberation_complete 
deliberation_incomplete 
deliberation_failure 
mutex_failure  Could not acquire or releas a mutex
aborted  Agent has been aborted
unknown_status 


Function Documentation

template<class LOCK>
void acquire LOCK &    lock,
const std::string &    locator
 

Function to acquire a lock on the LOCK.

If compiled with flag TRACE_LOCKS tracing of the lock will happen conform LockTrace. If acquiring the lock fails due to an error this function will invoke abort.

Todo:
Determine if abort is the thing we want to do.

char * IDEA::copyString const char *    str
 

Copies str and returns the copy.

bool IDEA::doesFileExist const std::string &    name
 

Returns true if the file name exists, otherwise returns false.

A file is considered to be existing if we can open it to read.

bool IDEA::findLeadingString const std::string &    text,
const char *    pattern
 

Returns true if text starts with pattern otherwise returns false.

bool IDEA::findString const std::string &    text,
const char *    pattern
 

Returns true if pattern can be found in text. Otherwise returns false.

bool IDEA::loadModules const std::string &    fileName
 

Takes module configuration file fileName and will load all the modules defined in the file. Will return true if all modules can be loaded succesfully otherwise returns false.

Assumes the file fileName contains references to shared libraries to be loaded. Each library will be loaded using loadSharedLibrary().

An example of the content of fileName:

    # load the modules for shared-timing-service
    /home/mydir/module-directory/libsharedtimingservice_o.so
    /home/mydir/module-directory/libsharedagenttimingservice_o.so
    

void * IDEA::loadSharedLibrary const std::string &    fileName
 

Loads the shared library fileName.

If fileName cannot be found, cannot be opened for reading, is not of an appropriate object format for processing by loadSharedLibrary, or if an error occurs during the process of loading file or relocating its symbolic references, loadSharedLibrary returns 0.

std::ostream & IDEA::operator<< std::ostream &    os,
const StringVector   ss
 

Streams the container in human readable format to os.

std::ostream & IDEA::operator<< std::ostream &    os,
const StringList   ss
 

Streams the container in human readable format to os.

std::ostream & IDEA::operator<< std::ostream &    os,
const StringSet   ss
 

Streams the container in human readable format to os.

std::ostream & IDEA::operator<< std::ostream &    os,
const IntSet   is
 

Streams the container in human readable format to os.

bool IDEA::readPlannerArg std::string &    arglist,
std::string &    arg
 

Takes a comma deliminated string argList and will populate arg with the first field if any and will remove this field from arglist. If no first field exists the function will return false otherwise it will return true.

Example:

    std::string argList = "  arg1,  arg2, arg3";
    std::string arg;
    bool returnValue = readPlannerArg( argList, arg );
    

Will result in the following values:

    argList "  arg2,arg3"
    arg "arg1"
    returnValue true
    

template<class LOCK>
void release LOCK &    lock,
const std::string &    locator
 

Function to release a lock on the LOCK.

If compiled with flag TRACE_LOCKS tracing of the lock will happen conform LockTrace. If releasing the lock fails due to an error this function will invoke abort.

Todo:
Determine if abort is the thing we want to do.

void IDEA::removeLeadingBlanks std::string &    text
 

Takes a string \text and will remove any white spaces at the front of the string.

void IDEA::removeTrailingBlanks std::string &    text
 

Takes a string \text and will remove any white spaces at the back of the string.

bool IDEA::toBool const std::string &    st
 

template<class Type>
std::string toString Type &    t
 

template<>
std::string IDEA::toString StatusType   t
 

Template specialization of toString for type StatusType. Converts the status type to a human understandable string.

template<>
std::string IDEA::toString bool &    t
 

Template specialization of toString for type bool. Puts bool values in alphabetic format.

template<>
std::string IDEA::toString double &    t
 

Template specialization of toString for type double. It sets the precision to 12.

The precision determines the maximum number of digits that shall be output on insertion operations to express floating-point values, counting both the digits before and after the decimal point.

template<class Type>
std::string toString Type &    t
 

Converts a value of type Type to a string.

Works for any type that supports iostream input and the types for which template specializations have been provided. For example:

    std::string doubleAsString = toString<double>( 10.12 );
    std::string intAsString = toString<int>( 12 );
    std::string statusTypeAsString = toString<const StatusType&>( status );
    

template<class Type>
bool IDEA::toValue const std::string &    st
 

Template specialization for type bool of toValue.


Variable Documentation

std::string IDEA::UNKNOWN = "UNKNOWN"
 

Variable to identify an unknown value.


Contact information
© IDEA
Generated on Fri Feb 3 17:09:44 2006 for IDEA.