LRAUV  revA
DirectoryEntry Class Reference

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

#include <DirectoryEntry.h>

Inheritance diagram for DirectoryEntry:
Collaboration diagram for DirectoryEntry:

Classes

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

Public Types

enum  DirectoryType { ACCESSOR = 'a', ELEMENT = 'e', NAME = 'n', VERSION = 'v' }
 Type of directory entry. 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

 DirectoryEntry (const short version=0)
 Version Construnctor. More...
 
 DirectoryEntry (DataAccess *dataAccess)
 Accessor Constructor. More...
 
 DirectoryEntry (const CodedStr *name)
 Name Constructor. More...
 
 DirectoryEntry (ElementURI *elementURI)
 ElementURI Constructor. More...
 
virtual ~DirectoryEntry ()
 Destructor. More...
 
void * operator new (size_t size)
 Override new. More...
 
void operator delete (void *p)
 Override delete. More...
 
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...
 
DirectoryType getDirectoryType (void) 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 unsigned short GetCurrentLogVersion ()
 
static unsigned short GetMinimumLogVersion ()
 
static DirectoryEntryRead (Timestamp &timeBase, InStream &inStream, unsigned short firstWord, Logger &logger)
 Read new DirectoryEntry from a stream. More...
 
static const char * DirectoryTypeToString (DirectoryType directoryType)
 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 DIRECTORY_TYPE_MASK = 7 << 2
 
- Static Public Attributes inherited from LogEntry
static const int TYPE_MASK = 0x0003
 

Protected Attributes

DirectoryType directoryType_
 
union {
   unsigned short   version_
 
   DataAccess *   dataAccess_
 
   ElementURI *   elementURI_
 
   const CodedStr *   name_
 
}; 
 
bool wasRead_
 Indicates whether the value was read in, and therefore can be deleted. More...
 
- Protected Attributes inherited from LogEntry
Type type_
 Stores the type of a given LogEntry. More...
 
Timestamp timestamp_
 

Static Protected Attributes

static unsigned short MinimumLogVersion_
 
static unsigned short CurrentLogVersion_
 
static RingBufferVoidMallocRing_
 Declared as a pointer to avoid including RingBuffer.h header here. More...
 
static DirectoryEntry::StaticDestructor StaticDestructor_
 Static instance of StaticDestructor. More...
 
static FlexArray< ElementURI * > ElementStore_
 Static storage of ElementURIs to delete at cleanup. More...
 
- Static Protected Attributes inherited from LogEntry
static const Str UNKNOWN
 

Additional Inherited Members

- 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
 
- 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 DirectoryEntry is serialized as:

  • a 16-bit header (serialized using OutStream::writeUShortCompact) including:
    • 8 high bits: character "<"
    • 3 bits: Zero.
    • 3 bits: DirectoryEntry::DirectoryType code, indicating the type of action being logged; e.g., the start of a cycle, the setting of accuracy, the setting of the state of a variable, or the setting of a variable to the "best" for its associated Universal variable
    • 2 bits: the code 01, indicating this is a DirectoryEntry
  • contents, depending on the type of Directory Entry, ending in a ">"

Constructor & Destructor Documentation

DirectoryEntry::DirectoryEntry ( const short  version = 0)

Version Construnctor.

Ver Construnctor.

Referenced by Read().

DirectoryEntry::DirectoryEntry ( DataAccess dataAccess)

Accessor Constructor.

DirectoryEntry::DirectoryEntry ( const CodedStr name)

Name Constructor.

Entity Name Constructor.

DirectoryEntry::DirectoryEntry ( ElementURI elementURI)

ElementURI Constructor.

DirectoryEntry::~DirectoryEntry ( )
virtual

Destructor.

Member Function Documentation

const char * DirectoryEntry::DirectoryTypeToString ( DirectoryType  directoryType)
static

Convert actions to Strs.

Convert an Action to a char*.

References ACCESSOR, ELEMENT, NAME, and VERSION.

Referenced by toString().

static unsigned short DirectoryEntry::GetCurrentLogVersion ( )
inlinestatic
DirectoryType DirectoryEntry::getDirectoryType ( void  ) const
inline

References directoryType_.

static unsigned short DirectoryEntry::GetMinimumLogVersion ( )
inlinestatic

References MinimumLogVersion_.

Referenced by Unserialize::Run().

void DirectoryEntry::operator delete ( void *  p)

Override delete.

void * DirectoryEntry::operator new ( size_t  size)

Override new.

Str DirectoryEntry::toString ( const Unit unit = NULL) const
virtual

Member Data Documentation

union { ... }
unsigned short DirectoryEntry::CurrentLogVersion_
staticprotected

Referenced by GetCurrentLogVersion(), and Read().

DataAccess* DirectoryEntry::dataAccess_

Referenced by toString(), and write().

const int DirectoryEntry::DIRECTORY_TYPE_MASK = 7 << 2
static
DirectoryType DirectoryEntry::directoryType_
protected

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

FlexArray< ElementURI * > DirectoryEntry::ElementStore_
staticprotected

Static storage of ElementURIs to delete at cleanup.

Referenced by Read(), and DirectoryEntry::StaticDestructor::~StaticDestructor().

ElementURI* DirectoryEntry::elementURI_

Referenced by toString(), and write().

RingBufferVoid * DirectoryEntry::MallocRing_
staticprotected

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

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

unsigned short DirectoryEntry::MinimumLogVersion_
staticprotected

Referenced by GetMinimumLogVersion(), and Read().

const CodedStr* DirectoryEntry::name_

Referenced by toString(), and write().

DirectoryEntry::StaticDestructor DirectoryEntry::StaticDestructor_
staticprotected

Static instance of StaticDestructor.

unsigned short DirectoryEntry::version_

Referenced by toString(), and write().

bool DirectoryEntry::wasRead_
protected

Indicates whether the value was read in, and therefore can be deleted.


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