OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::FileModule Class Reference
[Common Classes]

This class manages the files and FileSink and FileSource objects. More...

#include <FileModule.h>

Inheritance diagram for ot::FileModule:

Inheritance graph
[legend]
Collaboration diagram for ot::FileModule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FileModule ()
virtual ~FileModule ()
virtual void init (StringTable &attributes, ConfigNode *localTree)
virtual NodecreateNode (const std::string &name, StringTable &attributes)
virtual void pushEvent ()
virtual void close ()

Protected Attributes

std::map< std::string, NodeVectornodes
std::map< std::string, File * > files
std::list< FileSource * > sources
bool append
bool loop
double interval
bool ot11Format
bool realtime
double lastTime
Event event
double firstPlaybackTime
double firstSavedEventTime

Detailed Description

This class manages the files and FileSink and FileSource objects.

FileSources are driven by the main loop, whereas FileSinks write directly to the associated file, whenever they receive an event.

Author:
Gerhard Reitmayr

Definition at line 91 of file FileModule.h.


Constructor & Destructor Documentation

ot::FileModule::FileModule (  )  [inline]

constructor method.

initializes internal and static data such as the functionMap and keyMap tables.

Definition at line 123 of file FileModule.h.

ot::FileModule::~FileModule (  )  [virtual]

Destructor method, clears nodes member.

Definition at line 64 of file FileModule.cxx.

References files, and nodes.


Member Function Documentation

void ot::FileModule::close (  )  [virtual]

Closes the files and cleans up data structures.

Reimplemented from ot::Module.

Definition at line 297 of file FileModule.cxx.

References files.

Node * ot::FileModule::createNode ( const std::string &  name,
StringTable attributes 
) [virtual]

This method is called to construct a new Node.

It compares name to the FileSink or FileSource element name, and if it matches creates the necessary File and Node objects.

Parameters:
name reference to string containing element name reference to StringTable containing attribute values
Returns:
pointer to new Node or NULL. The new Node must be allocated with new !

Implements ot::NodeFactory.

Definition at line 106 of file FileModule.cxx.

References append, ot::Module::context, ot::FileSource::currentEvent, ot::FileSource::eventMap, ot::File::FILE_IN, ot::File::FILE_OUT, files, ot::Context::findFile(), firstSavedEventTime, ot::StringTable::get(), LOG_ACE_ERROR(), ot::File::loop, loop, ot::File::mode, nodes, ot11Format, ot::File::read(), realtime, ot::File::reset(), sources, and ot::Event::time.

void ot::FileModule::init ( StringTable attributes,
ConfigNode localTree 
) [virtual]

initializes the tracker module.

This class provides an implementation that sets the initialization flag to true. Subclasses should call this method if they override this method. It takes the attributes of the element configuring this module and a local tree consisting of the children of the element. This tree must be build of Nodes.

Parameters:
attributes StringTable of elements attribute values. Should be possibly , but is not for convenience.
localTree pointer to root of configuration nodes tree

Reimplemented from ot::Module.

Definition at line 73 of file FileModule.cxx.

References append, ot::StringTable::containsKey(), ot::OSUtils::currentTime(), firstSavedEventTime, ot::StringTable::get(), ot::Module::init(), interval, lastTime, loop, ot11Format, and realtime.

void ot::FileModule::pushEvent (  )  [virtual]

reads from the input files and fires new events, if necessary.

Reimplemented from ot::Module.

Definition at line 218 of file FileModule.cxx.

References ot::OSUtils::currentTime(), event, ot::File::FILE_IN, files, firstPlaybackTime, firstSavedEventTime, interval, lastTime, loop, nodes, ot::Event::null, realtime, sources, and ot::Event::time.


Member Data Documentation

bool ot::FileModule::append [protected]

flag whether output files should be appended to or not

Definition at line 102 of file FileModule.h.

Referenced by createNode(), and init().

local event

Definition at line 114 of file FileModule.h.

Referenced by pushEvent().

std::map<std::string, File *> ot::FileModule::files [protected]

map of name to File objects

Definition at line 98 of file FileModule.h.

Referenced by close(), createNode(), pushEvent(), and ~FileModule().

the time at which the first event was played back

Definition at line 116 of file FileModule.h.

Referenced by pushEvent().

the time at which the first event was recorded

Definition at line 118 of file FileModule.h.

Referenced by createNode(), init(), and pushEvent().

double ot::FileModule::interval [protected]

interval time between new events

Definition at line 106 of file FileModule.h.

Referenced by init(), and pushEvent().

double ot::FileModule::lastTime [protected]

last timestamp

Definition at line 112 of file FileModule.h.

Referenced by init(), and pushEvent().

bool ot::FileModule::loop [protected]

flag whether to loop input files or not

Definition at line 104 of file FileModule.h.

Referenced by createNode(), init(), and pushEvent().

std::map<std::string, NodeVector> ot::FileModule::nodes [protected]

map of name to list of either FileSink or FileSource nodes

Definition at line 96 of file FileModule.h.

Referenced by createNode(), pushEvent(), and ~FileModule().

bool ot::FileModule::ot11Format [protected]

flag whether to use OT v1.1 compatible file format (for testing purposes only)

Definition at line 108 of file FileModule.h.

Referenced by createNode(), and init().

bool ot::FileModule::realtime [protected]

flag whether to play back events in realtime

Definition at line 110 of file FileModule.h.

Referenced by createNode(), init(), and pushEvent().

std::list<FileSource*> ot::FileModule::sources [protected]

list of file sources

Definition at line 100 of file FileModule.h.

Referenced by createNode(), and pushEvent().


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

copyright (c) 2006 Graz University of Technology