Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TModuleBase Class Reference

#include <modulebase.h>

Inheritance diagram for TModuleBase:

TConfigurable ThreadableObject List of all members.

Public Member Functions

virtual void StartThreadFunc (void *p_argument)
 TModuleBase (char *p_programname, char *p_configfilename=NULL)
 ~TModuleBase ()
int Run ()

Protected Member Functions

HANDLE_STATUS HandleConfigLine (ConfigSource *p_parser)
void CheckConfig ()
void SendStatus (WORM_MSGTYPE_ID p_type, short p_ierr=0, const char *p_text=NULL)
virtual const char * GetDefaultConfigFile () const=0
virtual void Heartbeat ()
virtual bool PrepareToRun ()
virtual bool CheckForFatal ()
virtual WORM_STATUS_CODE MainThreadActions ()=0
virtual bool FinishedRunning ()

Protected Attributes

volatile bool Running
WORM_LOGGING_LEVEL LoggingLevel
TGlobalUtilsMyGlobalUtils
WORM_MSGTYPE_ID TYPE_ERROR
WORM_MSGTYPE_ID TYPE_HEARTBEAT
GEN_FILENAME ConfigFileName
int LoopSleepMS
WORM_RING_ID CommandRingKey
TRingWriter * CommandRing
THeartbeatMessage * HeartbeatMsg
TErrorMessage * ErrorMsg
long LastBeat

Constructor & Destructor Documentation

TModuleBase::TModuleBase char *    p_programname,
char *    p_configfilename = NULL
 

Definition at line 27 of file modulebase.cpp.

References CommandRing, CommandRingKey, DEF_LOOP_SLEEP_MS, ErrorMsg, EW_CONFIG_DIR, TGlobalUtils::GetEnvironmentValue(), HeartbeatMsg, LastBeat, TLogger::Logit(), LoopSleepMS, MyGlobalUtils, Running, WORM_CONFIG_DIR, and WORM_RING_INVALID.

TModuleBase::~TModuleBase  
 

Definition at line 129 of file modulebase.cpp.

References CommandRing, ErrorMsg, HeartbeatMsg, and MyGlobalUtils.


Member Function Documentation

void TModuleBase::CheckConfig   [protected, virtual]
 

Reimplemented from TConfigurable.

Definition at line 213 of file modulebase.cpp.

References CommandRingKey, TConfigurable::ConfigState, TGlobalUtils::GetHeartbeatInt(), ConfigSource::INVALID_INT, TConfigurable::IsReady(), TLogger::Logit(), TGlobalUtils::LookupMessageTypeId(), LoopSleepMS, MyGlobalUtils, TYPE_ERROR, TYPE_HEARTBEAT, WORM_MSGTYPE_INVALID, WORM_RING_INVALID, and WORM_STAT_BADSTATE.

virtual bool TModuleBase::CheckForFatal   [inline, protected, virtual]
 

Definition at line 208 of file modulebase.h.

Referenced by Run().

virtual bool TModuleBase::FinishedRunning   [inline, protected, virtual]
 

Definition at line 232 of file modulebase.h.

Referenced by Run().

virtual const char* TModuleBase::GetDefaultConfigFile   const [protected, pure virtual]
 

Referenced by Run().

HANDLE_STATUS TModuleBase::HandleConfigLine ConfigSource   p_parser [protected, virtual]
 

Reimplemented from TConfigurable.

Definition at line 153 of file modulebase.cpp.

References CommandRingKey, DEF_LOOP_SLEEP_MS, ConfigSource::GetCurrentLine(), HANDLE_STATUS, TGlobalUtils::HandleConfigLine(), HANDLER_INVALID, HANDLER_UNUSED, HANDLER_USED, ConfigSource::Int(), ConfigSource::INVALID_INT, ConfigSource::Its(), TLogger::Logit(), TGlobalUtils::LookupRingKey(), LoopSleepMS, MyGlobalUtils, ConfigSource::String(), and WORM_RING_INVALID.

Referenced by Run().

void TModuleBase::Heartbeat   [protected, virtual]
 

Definition at line 341 of file modulebase.cpp.

References TGlobalUtils::GetHeartbeatInt(), LastBeat, and SendStatus().

Referenced by Run().

virtual WORM_STATUS_CODE TModuleBase::MainThreadActions   [protected, pure virtual]
 

Referenced by Run().

virtual bool TModuleBase::PrepareToRun   [inline, protected, virtual]
 

Definition at line 196 of file modulebase.h.

References TGlobalUtils::GetLoggingLevel().

Referenced by Run().

int TModuleBase::Run  
 

Definition at line 355 of file modulebase.cpp.

References CheckForFatal(), COMFILE_EOF, COMFILE_ERROR, CommandRing, ConfigFileName, ConfigSource::Error(), ErrorMsg, FinishedRunning(), ConfigSource::GetCurrentLine(), GetDefaultConfigFile(), TGlobalUtils::GetLoggingLevel(), TGlobalUtils::GetThisModuleId(), HandleConfigLine(), HANDLER_UNUSED, Heartbeat(), HeartbeatMsg, TConfigurable::IsReady(), LoggingLevel, TLogger::Logit(), MainThreadActions(), TTimeFuncs::MSecSleep(), ConfigSource::NextToken(), TComFileParser::Open(), PrepareToRun(), TComFileParser::ReadLine(), Running, WORM_LOG_DEBUG, WORM_LOG_ERRORS, WORM_LOG_STATUS, WORM_STAT_FAILURE, WORM_STAT_NOMATCH, and WORM_STAT_SUCCESS.

void TModuleBase::SendStatus WORM_MSGTYPE_ID    p_type,
short    p_ierr = 0,
const char *    p_text = NULL
[protected]
 

Definition at line 275 of file modulebase.cpp.

References CommandRing, ErrorMsg, HeartbeatMsg, TLogger::Logit(), Running, TYPE_ERROR, TYPE_HEARTBEAT, and WORM_STAT_SUCCESS.

Referenced by Heartbeat().

virtual void TModuleBase::StartThreadFunc void *    p_argument [inline, virtual]
 

Implements ThreadableObject.

Definition at line 254 of file modulebase.h.


Member Data Documentation

TRingWriter* TModuleBase::CommandRing [protected]
 

Definition at line 148 of file modulebase.h.

Referenced by Run(), SendStatus(), TModuleBase(), and ~TModuleBase().

WORM_RING_ID TModuleBase::CommandRingKey [protected]
 

Definition at line 147 of file modulebase.h.

Referenced by CheckConfig(), HandleConfigLine(), and TModuleBase().

GEN_FILENAME TModuleBase::ConfigFileName [protected]
 

Definition at line 140 of file modulebase.h.

Referenced by Run().

TErrorMessage* TModuleBase::ErrorMsg [protected]
 

Definition at line 170 of file modulebase.h.

Referenced by Run(), SendStatus(), TModuleBase(), and ~TModuleBase().

THeartbeatMessage* TModuleBase::HeartbeatMsg [protected]
 

Definition at line 169 of file modulebase.h.

Referenced by Run(), SendStatus(), TModuleBase(), and ~TModuleBase().

long TModuleBase::LastBeat [protected]
 

Definition at line 184 of file modulebase.h.

Referenced by Heartbeat(), and TModuleBase().

WORM_LOGGING_LEVEL TModuleBase::LoggingLevel [protected]
 

Definition at line 132 of file modulebase.h.

Referenced by Run().

int TModuleBase::LoopSleepMS [protected]
 

Definition at line 143 of file modulebase.h.

Referenced by CheckConfig(), HandleConfigLine(), and TModuleBase().

TGlobalUtils* TModuleBase::MyGlobalUtils [protected]
 

Definition at line 134 of file modulebase.h.

Referenced by CheckConfig(), HandleConfigLine(), TModuleBase(), and ~TModuleBase().

volatile bool TModuleBase::Running [protected]
 

Definition at line 130 of file modulebase.h.

Referenced by Run(), SendStatus(), and TModuleBase().

WORM_MSGTYPE_ID TModuleBase::TYPE_ERROR [protected]
 

Definition at line 137 of file modulebase.h.

Referenced by CheckConfig(), and SendStatus().

WORM_MSGTYPE_ID TModuleBase::TYPE_HEARTBEAT [protected]
 

Definition at line 137 of file modulebase.h.

Referenced by CheckConfig(), and SendStatus().


The documentation for this class was generated from the following files:
Generated on Tue May 6 09:16:35 2003 for Earthworm Libs by doxygen1.3-rc3