FeeServer::Main Class Reference
[Core classes.]

#include <feeserver/fee_main.hh>

Collaboration diagram for FeeServer::Main:

Collaboration graph
[legend]

List of all members.


Detailed Description

The Feeserver Main manager of of the fee server.
Examples:

test_server.cc.


Public Types

enum  { Restart = 2, Update = 3, InitRestart = 4, DimExit = 204 }
enum  State { Collecting, Running, Error }

Public Member Functions

 Main (const std::string &name, const std::string &detector, const std::string &dns)
virtual ~Main ()
const std::string & Name () const
Steering routines
int Run (const unsigned int ce_timeout=2000)
void CleanUp ()
void Stop (int ret)
Init/CE thread handling
void SetCtrlEngine (ControlEngine &e)
ControlEngineCtrlEngine ()
const ControlEngineCtrlEngine () const
Message handling
MessageChannelMsgChannel ()
void Msg (Message::Event event, const std::string &where, const char *format,...)
void SetLogLevel (unsigned int mask)
unsigned int GetLogLevel () const
void SetWatchdogTimeout (unsigned int timeout)
unsigned int GetWatchdogTimeout () const
Server commands
void HandleCommand (Command &c)
bool AddCommand (ServerCommand *c)
void RemoveCommands ()
Services
int Publish (ServiceBase &service)
int Unpublish (const std::string &name)
void RemoveServices ()
void SetUpdateRate (unsigned short rate)
unsigned short GetUpdateRate () const
MonitorThreadMonThread ()
const MonitorThreadMonThread () const
Misc
const StateCurrentState () const
void SetIssueTimeout (unsigned long timeout)
unsigned long GetIssueTimeout () const

Protected Types

typedef std::vector
< ServerCommand * > 
CommandList

Protected Member Functions

 Main (const Main &)
Mainoperator= (const Main &)
virtual void ErrorHandler (int severity, int code, char *msg)
virtual void ExitHandler (int code)
void Init (const unsigned int ce_timeout=1000)

Protected Attributes

ErrorExitHandler * _error_exit
ControlEngine_control_engine
std::string _name
std::string _detector
int _retval
State _state
MessageChannel_msg_channel
AcknowledgeChannel_ack_channel
CommandChannel_cmd_channel
MessageWatchdog_msg_watchdog
Acknowledge _ack
Mutex _command_mutex
Mutex _wait_mutex
Condition _wait_condition
Thread::Attributes _detached_attr
IssueThread _issue_thread
unsigned long _issue_timeout
MonitorThread _mon_thread
CommandList _commands
unsigned long _msg_mask
unsigned long _msg_timeout

Friends

class ErrorExitHandler
class IssueThread

Member Typedef Documentation

typedef std::vector<ServerCommand*> FeeServer::Main::CommandList [protected]

A list of server commands


Member Enumeration Documentation

anonymous enum

Enumerator:
Restart  return value that restart the server
Update  Return value that updates and restarts the server
InitRestart  Return value that says we should restart since init failed
DimExit  Dim error

States of the fee server

Enumerator:
Collecting  Collecting information
Running  Running
Error  In error


Constructor & Destructor Documentation

FeeServer::Main::Main ( const std::string &  name,
const std::string &  detector,
const std::string &  dns 
)

Constructor

Parameters:
name Name of server
detector name of detector (max 3 letters)
dns DIM domain name server host

FeeServer::Main::~Main (  )  [virtual]

Destructor

FeeServer::Main::Main ( const Main  )  [protected]

Not implemented


Member Function Documentation

const std::string& FeeServer::Main::Name (  )  const [inline]

Get the name

int FeeServer::Main::Run ( const unsigned int  ce_timeout = 2000  ) 

Run the fee server

Parameters:
ce_timeout Time out for CE to start (milliseconds)
Returns:
0 on succces, error code otherwise

void FeeServer::Main::CleanUp (  ) 

Clean up all

void FeeServer::Main::Stop ( int  ret  ) 

Stop the server

Parameters:
ret is the return value

void FeeServer::Main::SetCtrlEngine ( ControlEngine e  )  [inline]

Set the control engine

ControlEngine& FeeServer::Main::CtrlEngine (  )  [inline]

Get reference to the control engine

const ControlEngine& FeeServer::Main::CtrlEngine (  )  const [inline]

Get reference to the control engine

MessageChannel& FeeServer::Main::MsgChannel (  )  [inline]

Get a reference to the message channel

Returns:
reference to the message channel

void FeeServer::Main::Msg ( Message::Event  event,
const std::string &  where,
const char *  format,
  ... 
)

Make a message. If the message channel isn't up and running yet, we simply print to standard out.

Parameters:
event Event type
where Where the message came from
format printf like format

void FeeServer::Main::SetLogLevel ( unsigned int  mask  ) 

Set the log-level

unsigned int FeeServer::Main::GetLogLevel (  )  const

Get the log mask

void FeeServer::Main::SetWatchdogTimeout ( unsigned int  timeout  ) 

Set the watchdog time out

unsigned int FeeServer::Main::GetWatchdogTimeout (  )  const

Set the watchdog time out

void FeeServer::Main::HandleCommand ( Command c  ) 

Handle commands arriving over the command channel

bool FeeServer::Main::AddCommand ( ServerCommand c  ) 

Add a command to the known server commands

void FeeServer::Main::RemoveCommands (  ) 

Remove commands

int FeeServer::Main::Publish ( ServiceBase service  ) 

publish a service

Examples:
test_server.cc.

int FeeServer::Main::Unpublish ( const std::string &  name  ) 

Un-publish a service. It is not removed from the list, but will not be updated

void FeeServer::Main::RemoveServices (  ) 

Remove all services

void FeeServer::Main::SetUpdateRate ( unsigned short  rate  )  [inline]

Set the update rate time out in milliseconds

unsigned short FeeServer::Main::GetUpdateRate (  )  const [inline]

Get the update rate in milliseconds

MonitorThread& FeeServer::Main::MonThread (  )  [inline]

const MonitorThread& FeeServer::Main::MonThread (  )  const [inline]

const State& FeeServer::Main::CurrentState (  )  const [inline]

Get the state of the fee server

void FeeServer::Main::SetIssueTimeout ( unsigned long  timeout  )  [inline]

Set the issue time out in milliseconds

unsigned long FeeServer::Main::GetIssueTimeout (  )  const [inline]

Get the issue timeout in milliseconds

Main& FeeServer::Main::operator= ( const Main  )  [protected]

Not implemented

void FeeServer::Main::ErrorHandler ( int  severity,
int  code,
char *  msg 
) [protected, virtual]

Handle DIM errors

void FeeServer::Main::ExitHandler ( int  code  )  [protected, virtual]

Handle DIM exit requests

void FeeServer::Main::Init ( const unsigned int  ce_timeout = 1000  )  [protected]

Initialize

Parameters:
ce_timeout Time out for CE startup


Friends And Related Function Documentation

friend class ErrorExitHandler [friend]

Handler of DIM errors and exit requests is a friend

friend class IssueThread [friend]

Issue thread is a friend


Member Data Documentation

ErrorExitHandler* FeeServer::Main::_error_exit [protected]

Handle DIM errors and exit requests

The control engine

std::string FeeServer::Main::_name [protected]

Name of the server

std::string FeeServer::Main::_detector [protected]

Name of the detector

int FeeServer::Main::_retval [protected]

The return value of the server

State of the fee server

The message channel

The acknowledge channel

The command channel

Message channel watch dog

Acknowledge structure

Mutex to lock command handling

Mutex to lock issue handling

Condition to wait for issue to finish

Attributes for issue thread

Issue thread

unsigned long FeeServer::Main::_issue_timeout [protected]

Timeout for call of issue - the longest time a command can be executed by the CE, before the watch dog kills this thread. This value is given in milliseconds.

Monitor thread

The list of known server commands

unsigned long FeeServer::Main::_msg_mask [mutable, protected]

unsigned long FeeServer::Main::_msg_timeout [mutable, protected]


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

Generated on Thu Jun 26 17:02:31 2008 for FeeServer++ 0.9 by  doxygen 1.5.6