Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EventLogger Class Reference

#include <EventLogger.h>

Inheritance diagram for EventLogger:

Inheritance graph
[legend]
List of all members.

Detailed Description

allows logging of events to the console or a file

Definition at line 16 of file EventLogger.h.

Public Member Functions

 EventLogger ()
 constructor
virtual ~EventLogger ()
 destructor
virtual ControlBasedoSelect ()
 opens a custom (embedded) menu to toggle individual EGIDs
virtual void refresh ()
 called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed
virtual void processEvent (const EventBase &event)
 sends all events received to stdout and/or logfile

Static Public Member Functions

static class SocketgetLogSocket ()
 returns logSocket
static int getLogSocketPort ()
 returns port
static void setLogSocketPort (int p)
 sets port
static void logImage (FilterBankGenerator &fbg, unsigned int layer, unsigned int channel, const BehaviorBase *source=NULL)
 send the current camera image over the log socket
static void logMessage (std::string msg, const BehaviorBase *source=NULL, const char *icon=NULL, unsigned int placement=0)
 send a string over the log socket
static void logWebcam (const BehaviorBase *source=NULL)
 request that the desktop side take a picture with the webcam (if available)
static int callback (char *buf, int bytes)
 called by wireless when there's new data

Protected Types

typedef std::set< BehaviorBase * > registry_t
 the type of the behavior registry (BehaviorBase::registry)
typedef std::multiset< const
StateNode * > 
expected_t
 the type of expected
typedef std::set< std::string > listen_t
 the type of listen
typedef std::queue< EventBasequeuedEvents_t
 the type of queuedEvents

Protected Member Functions

virtual void clearSlots ()
 deletes each slot item and clears the slots
void setStatus (unsigned int i, char c)
 sets the status char of slot i to c
void checkLogFile ()
 checks to see if logfilePath differs from the StringInputControl's value and switches it if it is
void spider (const StateNode *n, unsigned int depth=0)
 dumps all of the transitions and subnodes of a given statenode
bool isListening (const StateNode *n)
 returns true iff n or one of its parents is found in listen
void runCommand (const std::string &s)
 parses commands sent from callback()
void indent (unsigned int level)
 just to prettify the data sent out - probably should make this a null-op to save bandwidth after debugging is done
const StateNodefind (const std::string &name)
 searches currently instantiated StateNodes to find the one named name
virtual void processStateMachineEvent (const EventBase &event)
 if there is a remote monitor listening for state machine transitions, this will send them over

Protected Attributes

std::string logfilePath
 address of the logfile, if any (empty string is no logfile)
std::ofstream logfile
 if a filename is given, events are logged to here
unsigned int verbosity
 controls the level of verbosity - currently 0 through 2
expected_t expected
 a set of behaviors which are involved with an impending transition - their next stateMachineEGID event should be ignored
listen_t listen
 a set of state machine names which should have their subnodes monitored
queuedEvents_t queuedEvents
 used if a transition causes other transitions, those transitions need to be remembered

Static Protected Attributes

static EventLoggertheOne = NULL
 the instance which will handle network communication
static class StateMachineListener smProcess
 handles state machine transitions if the Storyboard GUI (or other remote monitor) is listening for state machine events
static class SocketlogSocket = NULL
 events which are logged will be sent over this port in an xml format. See eventlog.dtd in the docs directory
static int port = 10080
 port number logSocket will listen on
static unsigned int logSocketRefCount = 0
 reference count for logSocket -- when this hits 0, close the socket

Classes

class  StateMachineListener
 a separate processEvent to distinguish between events requested for logging and events requested by a remote monitor More...


Member Typedef Documentation

typedef std::multiset<const StateNode*> EventLogger::expected_t [protected]

the type of expected

Definition at line 112 of file EventLogger.h.

typedef std::set<std::string> EventLogger::listen_t [protected]

the type of listen

Definition at line 115 of file EventLogger.h.

typedef std::queue<EventBase> EventLogger::queuedEvents_t [protected]

the type of queuedEvents

Definition at line 118 of file EventLogger.h.

typedef std::set<BehaviorBase*> EventLogger::registry_t [protected]

the type of the behavior registry (BehaviorBase::registry)

Definition at line 110 of file EventLogger.h.


Constructor & Destructor Documentation

EventLogger::EventLogger (  ) 

constructor

Definition at line 25 of file EventLogger.cc.

EventLogger::~EventLogger (  )  [virtual]

destructor

Definition at line 47 of file EventLogger.cc.


Member Function Documentation

int EventLogger::callback ( char *  buf,
int  bytes 
) [static]

called by wireless when there's new data

Definition at line 378 of file EventLogger.cc.

Referenced by EventLogger().

void EventLogger::checkLogFile (  )  [protected]

checks to see if logfilePath differs from the StringInputControl's value and switches it if it is

Definition at line 236 of file EventLogger.cc.

Referenced by processEvent(), and refresh().

void EventLogger::clearSlots (  )  [protected, virtual]

deletes each slot item and clears the slots

Reimplemented from ControlBase.

Definition at line 225 of file EventLogger.cc.

Referenced by ~EventLogger().

ControlBase * EventLogger::doSelect (  )  [virtual]

opens a custom (embedded) menu to toggle individual EGIDs

Reimplemented from ControlBase.

Definition at line 61 of file EventLogger.cc.

const StateNode * EventLogger::find ( const std::string &  name  )  [protected]

searches currently instantiated StateNodes to find the one named name

Definition at line 318 of file EventLogger.cc.

Referenced by runCommand().

static class Socket* EventLogger::getLogSocket (  )  [inline, static]

returns logSocket

Definition at line 32 of file EventLogger.h.

static int EventLogger::getLogSocketPort (  )  [inline, static]

returns port

Definition at line 35 of file EventLogger.h.

void EventLogger::indent ( unsigned int  level  )  [protected]

just to prettify the data sent out - probably should make this a null-op to save bandwidth after debugging is done

Definition at line 313 of file EventLogger.cc.

Referenced by processStateMachineEvent(), and spider().

bool EventLogger::isListening ( const StateNode n  )  [protected]

returns true iff n or one of its parents is found in listen

Definition at line 304 of file EventLogger.cc.

Referenced by processStateMachineEvent().

void EventLogger::logImage ( FilterBankGenerator fbg,
unsigned int  layer,
unsigned int  channel,
const BehaviorBase source = NULL 
) [static]

send the current camera image over the log socket

Definition at line 131 of file EventLogger.cc.

void EventLogger::logMessage ( std::string  msg,
const BehaviorBase source = NULL,
const char *  icon = NULL,
unsigned int  placement = 0 
) [static]

send a string over the log socket

Definition at line 171 of file EventLogger.cc.

void EventLogger::logWebcam ( const BehaviorBase source = NULL  )  [static]

request that the desktop side take a picture with the webcam (if available)

Definition at line 200 of file EventLogger.cc.

void EventLogger::processEvent ( const EventBase event  )  [virtual]

sends all events received to stdout and/or logfile

Implements EventListener.

Definition at line 102 of file EventLogger.cc.

Referenced by processStateMachineEvent().

void EventLogger::processStateMachineEvent ( const EventBase event  )  [protected, virtual]

if there is a remote monitor listening for state machine transitions, this will send them over

this is called by the StateMachineListener, which is subscribed to only those machines which have been requested by the remote monitor

Definition at line 392 of file EventLogger.cc.

Referenced by EventLogger::StateMachineListener::processEvent().

void EventLogger::refresh (  )  [virtual]

called when the child has deactivated and this control should refresh its display, or some other event (such as the user pressing the refresh button) has happened to cause a refresh to be needed

Reimplemented from ControlBase.

Definition at line 96 of file EventLogger.cc.

Referenced by doSelect().

void EventLogger::runCommand ( const std::string &  s  )  [protected]

parses commands sent from callback()

Definition at line 329 of file EventLogger.cc.

Referenced by callback().

static void EventLogger::setLogSocketPort ( int  p  )  [inline, static]

sets port

Definition at line 38 of file EventLogger.h.

void EventLogger::setStatus ( unsigned int  i,
char  c 
) [protected]

sets the status char of slot i to c

Definition at line 230 of file EventLogger.cc.

Referenced by checkLogFile(), and doSelect().

void EventLogger::spider ( const StateNode n,
unsigned int  depth = 0 
) [protected]

dumps all of the transitions and subnodes of a given statenode

Definition at line 258 of file EventLogger.cc.

Referenced by runCommand().


Member Data Documentation

a set of behaviors which are involved with an impending transition - their next stateMachineEGID event should be ignored

Definition at line 113 of file EventLogger.h.

Referenced by processStateMachineEvent(), and ~EventLogger().

a set of state machine names which should have their subnodes monitored

Definition at line 116 of file EventLogger.h.

Referenced by isListening(), processStateMachineEvent(), and runCommand().

std::ofstream EventLogger::logfile [protected]

if a filename is given, events are logged to here

Definition at line 96 of file EventLogger.h.

Referenced by checkLogFile(), doSelect(), and processEvent().

std::string EventLogger::logfilePath [protected]

address of the logfile, if any (empty string is no logfile)

Definition at line 93 of file EventLogger.h.

Referenced by checkLogFile().

Socket * EventLogger::logSocket = NULL [static, protected]

events which are logged will be sent over this port in an xml format. See eventlog.dtd in the docs directory

Definition at line 99 of file EventLogger.h.

Referenced by EventLogger(), getLogSocket(), indent(), logImage(), logMessage(), logWebcam(), processEvent(), processStateMachineEvent(), runCommand(), spider(), and ~EventLogger().

unsigned int EventLogger::logSocketRefCount = 0 [static, protected]

reference count for logSocket -- when this hits 0, close the socket

Definition at line 105 of file EventLogger.h.

Referenced by EventLogger(), and ~EventLogger().

int EventLogger::port = 10080 [static, protected]

port number logSocket will listen on

Definition at line 102 of file EventLogger.h.

Referenced by EventLogger(), getLogSocketPort(), and setLogSocketPort().

used if a transition causes other transitions, those transitions need to be remembered

Definition at line 119 of file EventLogger.h.

Referenced by processStateMachineEvent(), and ~EventLogger().

handles state machine transitions if the Storyboard GUI (or other remote monitor) is listening for state machine events

Definition at line 62 of file EventLogger.h.

Referenced by runCommand().

EventLogger * EventLogger::theOne = NULL [static, protected]

the instance which will handle network communication

Definition at line 52 of file EventLogger.h.

Referenced by callback(), EventLogger(), EventLogger::StateMachineListener::processEvent(), and ~EventLogger().

unsigned int EventLogger::verbosity [protected]

controls the level of verbosity - currently 0 through 2

Definition at line 108 of file EventLogger.h.

Referenced by EventLogger(), and processEvent().


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

Tekkotsu v3.0
Generated Wed Oct 4 00:05:00 2006 by Doxygen 1.4.7