LRAUV  revA
EventEntry Class Reference

Code unit that represents an event to be stored in the log file. More...

#include <EventEntry.h>

Inheritance diagram for EventEntry:
Collaboration diagram for EventEntry:

Classes

class  StaticDestructor
 Makes sure that mallocRing_s is deleted on shutdown. More...
 

Public Types

enum  EventType { START_CYCLE = 0, SET_DATA_ACCURACY = 1 << 2, SET_DATA_STATE = 2 << 2, COMPONENT_ACTION = 3 << 2 }
 Type of data event. More...
 
enum  DataStateChange {
  NO_DATA_STATE_CHANGE = 0, DATA_STATE_CHANGE_UNAVAILABLE = 2, DATA_STATE_CHANGE_AVAILABLE = 4, DATA_STATE_CHANGE_ORPHANED = 8,
  DATA_STATE_CHANGE_UNORPHANED = 16, DATA_STATE_CHANGE_SET_BEST = 32, DATA_STATE_CHANGE_INVALID = 64, DATA_STATE_CHANGE_VALID = 128
}
 
enum  ComponentAction { COMPONENT_LOAD = 0, COMPONENT_MISSION_RUN = 1 << 2, COMPONENT_FAIL = 2 << 2 }
 Type of component event. More...
 
- Public Types inherited from LogEntry
enum  Type {
  NOT_LOG_ENTRY = -1, EVENT_LOG_ENTRY = 0, DIRECTORY_LOG_ENTRY = 1, DATA_LOG_ENTRY = 2,
  SYSLOG_LOG_ENTRY = 3
}
 Defines an enum for "typing" the various LogEntries. More...
 

Public Member Functions

 EventEntry (Component *actor, DataElement *dataElement, const EventType eventType)
 EventType Constructor. More...
 
 EventEntry (Component *actor, DataElement *dataElement, const DataStateChange dataStateChange)
 DataStateChange Constructor. More...
 
 EventEntry (Component *actor, const bool loaded)
 ComponentAction = COMPONENT_LOAD Constructor. More...
 
 EventEntry (Component *actor, const int loop)
 ComponentAction = COMPONENT_RUN Constructor. More...
 
 EventEntry (Component *actor, const FailureMode::FailType failure, const int failCount)
 ComponentAction = COMPONENT_FAIL Constructor. More...
 
virtual ~EventEntry ()
 Destructor. More...
 
void * operator new (size_t size)
 Override new. More...
 
void operator delete (void *p)
 Override delete. More...
 
const void setAccuracy (const double &accuracy)
 
const double & getAccuracy (void) const
 
virtual unsigned int write (Timestamp &timeBase, OutStream &logStream) const
 Send payload to a stream. More...
 
virtual Str toString (const Unit *unit=NULL) const
 Convert payload to Str. More...
 
unsigned short getActorCode () const
 
ComponentAction getComponentAction (void) const
 
unsigned short getDataElementCode (void) const
 
EventType getEventType (void) const
 
DataStateChange getDataStateChange (void) const
 
void setDataStateChange (const DataStateChange dataStateChange)
 
int getRunLoop () const
 
bool getLoaded () const
 
FailureMode::FailType getFailureMode () const
 
int getFailCount () const
 
- Public Member Functions inherited from LogEntry
virtual ~LogEntry ()
 Destructor. More...
 
const TimestampgetTimestamp (void) const
 Accessors. More...
 
const TimestampsetTimestamp (const Timestamp &newTime)
 
const TimestampsetTimestamp (const double newTime)
 
Type getType (void) const
 

Static Public Member Functions

static EventEntryRead (Timestamp &timeBase, Timespan &timeAdjust, InStream &inStream, unsigned short firstWord, Logger &logger)
 Read new EventEntry from a stream. More...
 
static const char * EventTypeToString (EventType theAction)
 Convert actions to Strs. More...
 
static const char * StateChangeToString (DataStateChange dataStateChange)
 Convert actions to Strs. More...
 
- Static Public Member Functions inherited from LogEntry
static LogEntryRead (Timestamp &timeBase, Timespan &timeAdjust, InStream &inStream, Logger &logger)
 Read in a new entry from a stream. More...
 
static const char * TypeToString (Type theType)
 Convert types to Strs. More...
 

Static Public Attributes

static const int EVENT_TYPE_MASK = 3 << 2
 
static const int COMPONENT_ACTION_MASK = 3 << 2
 
- Static Public Attributes inherited from LogEntry
static const int TYPE_MASK = 0x0003
 

Protected Member Functions

 EventEntry (const Timestamp &timestamp, const unsigned short actorCode, const unsigned short dataElementCode, const EventType action, const double &accuracy=0.0)
 Protected EventType Constructor. More...
 
 EventEntry (const Timestamp &timestamp, const unsigned short actorCode, const unsigned short dataElementCode, const DataStateChange dataStateChange, const double &accuracy=0.0)
 Protected DataStateChange Constructor. More...
 
 EventEntry (const Timestamp &timestamp, const unsigned short actorCode, const bool loaded)
 Protected ComponentAction = COMPONENT_LOAD Constructor. More...
 
 EventEntry (const Timestamp &timestamp, const unsigned short actorCode, const int loop)
 Protected ComponentAction = COMPONENT_RUN Constructor. More...
 
 EventEntry (const Timestamp &timestamp, const unsigned short actorCode, const FailureMode::FailType failure, const int failCount)
 Protected ComponentAction = COMPONENT_FAIL Constructor. More...
 
virtual const Str makeComponentActionString () const
 
virtual const Str makeDataValueString () const
 
- Protected Member Functions inherited from LogEntry
 LogEntry (Type myType, const Timestamp &timestamp=Timestamp::NOT_SET_TIME)
 Constructor. More...
 
unsigned int writeTimestamp (const Timestamp &timeBase, bool changed, OutStream &logStream, Logger::TimePrecisionType timePrecision) const
 

Protected Attributes

unsigned short actorCode_
 Arg1. More...
 
union {
   unsigned short   dataElementCode_
 
   bool   loaded_
 
   int   runLoop_
 
   FailureMode::FailType   failureMode_
 
}; 
 Arg2. More...
 
EventType eventType_
 Arg3. More...
 
union {
   DataStateChange   dataStateChange_
 
   ComponentAction   componentAction_
 
}; 
 Arg4. More...
 
union {
   double   accuracy_
 
   int   failCount_
 
}; 
 Arg5. More...
 
- Protected Attributes inherited from LogEntry
Type type_
 Stores the type of a given LogEntry. More...
 
Timestamp timestamp_
 

Static Protected Attributes

static RingBufferVoidMallocRing_
 Declared as a pointer to avoid including RingBuffer.h header here. More...
 
static EventEntry::StaticDestructor StaticDestructor_
 Static instance of StaticDestructor. More...
 
- Static Protected Attributes inherited from LogEntry
static const Str UNKNOWN
 

Additional Inherited Members

- Static Protected Member Functions inherited from LogEntry
static bool ReadTimestamp (Timestamp &timestamp, bool &changed, InStream &inStream, Logger &logger, Logger::TimePrecisionType timePrecision)
 

Detailed Description

Code unit that represents an event to be stored in the log file.

The kinds of events include:

  • Starting a computation cycle
  • Setting the accuracy of a variable
  • Setting the state of a variable
  • Setting the "Best" value of a UniversalDataElement

An EventEntry is serialized as:

Constructor & Destructor Documentation

EventEntry::EventEntry ( Component actor,
DataElement dataElement,
const EventType  eventType 
)

EventType Constructor.

Referenced by Read().

EventEntry::EventEntry ( Component actor,
DataElement dataElement,
const DataStateChange  dataStateChange 
)

DataStateChange Constructor.

EventEntry::EventEntry ( Component actor,
const bool  loaded 
)

ComponentAction = COMPONENT_LOAD Constructor.

EventEntry::EventEntry ( Component actor,
const int  loop 
)

ComponentAction = COMPONENT_RUN Constructor.

EventEntry::EventEntry ( Component actor,
const FailureMode::FailType  failure,
const int  failCount 
)

ComponentAction = COMPONENT_FAIL Constructor.

EventEntry::~EventEntry ( )
virtual

Destructor.

EventEntry::EventEntry ( const Timestamp timestamp,
const unsigned short  actorCode,
const unsigned short  dataElementCode,
const EventType  action,
const double &  accuracy = 0.0 
)
protected

Protected EventType Constructor.

EventEntry::EventEntry ( const Timestamp timestamp,
const unsigned short  actorCode,
const unsigned short  dataElementCode,
const DataStateChange  dataStateChange,
const double &  accuracy = 0.0 
)
protected

Protected DataStateChange Constructor.

EventEntry::EventEntry ( const Timestamp timestamp,
const unsigned short  actorCode,
const bool  loaded 
)
protected

Protected ComponentAction = COMPONENT_LOAD Constructor.

EventEntry::EventEntry ( const Timestamp timestamp,
const unsigned short  actorCode,
const int  loop 
)
protected

Protected ComponentAction = COMPONENT_RUN Constructor.

EventEntry::EventEntry ( const Timestamp timestamp,
const unsigned short  actorCode,
const FailureMode::FailType  failure,
const int  failCount 
)
protected

Protected ComponentAction = COMPONENT_FAIL Constructor.

Member Function Documentation

const char * EventEntry::EventTypeToString ( EventType  theAction)
static

Convert actions to Strs.

Convert an Action to a char*.

References COMPONENT_ACTION, SET_DATA_ACCURACY, SET_DATA_STATE, and START_CYCLE.

Referenced by toString(), and EventTypeRule::toString().

const double& EventEntry::getAccuracy ( void  ) const
inline

References accuracy_.

Referenced by write().

unsigned short EventEntry::getActorCode ( ) const
inline

References actorCode_.

Referenced by BinaryLogReader::read().

ComponentAction EventEntry::getComponentAction ( void  ) const
inline

References componentAction_.

Referenced by BinaryLogReader::read(), and write().

unsigned short EventEntry::getDataElementCode ( void  ) const
inline

References dataElementCode_.

Referenced by write().

DataStateChange EventEntry::getDataStateChange ( void  ) const
inline

References dataStateChange_.

Referenced by write().

EventType EventEntry::getEventType ( void  ) const
inline
int EventEntry::getFailCount ( void  ) const
inline

References failCount_.

Referenced by write().

FailureMode::FailType EventEntry::getFailureMode ( ) const
inline

References failureMode_.

Referenced by write().

bool EventEntry::getLoaded ( ) const
inline

References loaded_.

Referenced by write().

int EventEntry::getRunLoop ( ) const
inline

References runLoop_.

Referenced by BinaryLogReader::read(), and write().

const Str EventEntry::makeComponentActionString ( ) const
protectedvirtual
const Str EventEntry::makeDataValueString ( ) const
protectedvirtual
void EventEntry::operator delete ( void *  p)

Override delete.

void * EventEntry::operator new ( size_t  size)

Override new.

const void EventEntry::setAccuracy ( const double &  accuracy)
inline

References accuracy_.

void EventEntry::setDataStateChange ( const DataStateChange  dataStateChange)
inline

References dataStateChange_.

const char * EventEntry::StateChangeToString ( DataStateChange  dataStateChange)
static

Member Data Documentation

union { ... }

Arg2.

union { ... }

Arg4.

union { ... }

Arg5.

double EventEntry::accuracy_
unsigned short EventEntry::actorCode_
protected

Arg1.

Referenced by getActorCode(), toString(), and write().

const int EventEntry::COMPONENT_ACTION_MASK = 3 << 2
static
ComponentAction EventEntry::componentAction_
unsigned short EventEntry::dataElementCode_

Referenced by getDataElementCode(), and toString().

DataStateChange EventEntry::dataStateChange_
const int EventEntry::EVENT_TYPE_MASK = 3 << 2
static

Referenced by Read().

EventType EventEntry::eventType_
protected
int EventEntry::failCount_
FailureMode::FailType EventEntry::failureMode_
bool EventEntry::loaded_
RingBufferVoid * EventEntry::MallocRing_
staticprotected

Declared as a pointer to avoid including RingBuffer.h header here.

Referenced by EventEntry::StaticDestructor::~StaticDestructor().

int EventEntry::runLoop_
EventEntry::StaticDestructor EventEntry::StaticDestructor_
staticprotected

Static instance of StaticDestructor.


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