#include <feeserver/fee_main.hh>

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) |
| ControlEngine & | CtrlEngine () |
| const ControlEngine & | CtrlEngine () const |
Message handling | |
| MessageChannel & | MsgChannel () |
| 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 |
| MonitorThread & | MonThread () |
| const MonitorThread & | MonThread () const |
Misc | |
| const State & | CurrentState () const |
| void | SetIssueTimeout (unsigned long timeout) |
| unsigned long | GetIssueTimeout () const |
Protected Types | |
| typedef std::vector < ServerCommand * > | CommandList |
Protected Member Functions | |
| Main (const Main &) | |
| Main & | operator= (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 |
typedef std::vector<ServerCommand*> FeeServer::Main::CommandList [protected] |
A list of server commands
| anonymous enum |
| FeeServer::Main::Main | ( | const std::string & | name, | |
| const std::string & | detector, | |||
| const std::string & | dns | |||
| ) |
Constructor
| 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
| 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
| ce_timeout | Time out for CE to start (milliseconds) |
| void FeeServer::Main::CleanUp | ( | ) |
Clean up all
| void FeeServer::Main::Stop | ( | int | ret | ) |
Stop the server
| 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
| 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.
| 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
| 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
| 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
| ce_timeout | Time out for CE startup |
friend class ErrorExitHandler [friend] |
Handler of DIM errors and exit requests is a friend
friend class IssueThread [friend] |
Issue thread is a friend
ErrorExitHandler* FeeServer::Main::_error_exit [protected] |
Handle DIM errors and exit requests
ControlEngine* FeeServer::Main::_control_engine [protected] |
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 FeeServer::Main::_state [protected] |
State of the fee server
MessageChannel* FeeServer::Main::_msg_channel [protected] |
The message channel
AcknowledgeChannel* FeeServer::Main::_ack_channel [protected] |
The acknowledge channel
CommandChannel* FeeServer::Main::_cmd_channel [protected] |
The command channel
MessageWatchdog* FeeServer::Main::_msg_watchdog [protected] |
Message channel watch dog
Acknowledge FeeServer::Main::_ack [protected] |
Acknowledge structure
Mutex FeeServer::Main::_command_mutex [protected] |
Mutex to lock command handling
Mutex FeeServer::Main::_wait_mutex [protected] |
Mutex to lock issue handling
Condition FeeServer::Main::_wait_condition [protected] |
Condition to wait for issue to finish
Thread::Attributes FeeServer::Main::_detached_attr [protected] |
Attributes for issue thread
IssueThread FeeServer::Main::_issue_thread [protected] |
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.
MonitorThread FeeServer::Main::_mon_thread [protected] |
Monitor thread
CommandList FeeServer::Main::_commands [protected] |
The list of known server commands
unsigned long FeeServer::Main::_msg_mask [mutable, protected] |
unsigned long FeeServer::Main::_msg_timeout [mutable, protected] |
1.5.6