Base class for all CODA objects implements standard functionality. More...
#include <CodaObject.hxx>
Public Member Functions | |
CodaObject (const string &UDL, const string &name, const string &descr, const string &codaClass="user", const cMsgSubscriptionConfig *scfg=NULL, int connTimeout=10) throw (CodaException) | |
CodaObject constructor. | |
virtual | ~CodaObject (void) throw () |
CodaObject destructor. | |
int | daLogMsg (const string &text, int sevid, const string &daLogSubj="") const throw (CodaException) |
Called by user to send daLogMsg. | |
virtual void | startProcessing (void) throw (CodaException) |
Called to start processing. | |
virtual void | stopProcessing (void) throw (CodaException) |
Called to stop processing. | |
string | getObjectType (void) const throw () |
Returns object type. | |
string | getCodaClass (void) const throw () |
Returns object coda class. | |
string | getHostName (void) const throw () |
Returns Host Name. | |
string | getUserName (void) const throw () |
Returns User Name. | |
string | getState (void) const throw () |
Returns object state. | |
string | getStatus (void) const throw () |
Returns object status. | |
string | getConfig (void) const throw () |
Returns object config. | |
void | changeState (const string &newState) throw (CodaException) |
Must be called by the user when the object changes state. | |
void | changeStatus (const string &newStatus) throw (CodaException) |
Must be called by the user when the object changes status. | |
Public Attributes | |
cMsg * | rcConn |
cMsg run control connection object. | |
string | CodaObjectDaLogSubject |
optional daLog message subject. | |
Static Public Attributes | |
static int | debug = 0 |
Global debug flag. | |
Protected Member Functions | |
virtual void | sendResponse (const cMsgMessage *msg, const string &subject, const string &type, const string &text, int userInt) const throw (CodaException) |
Internal routine creates, fills, and sends response message. | |
virtual void | userMsgHandler (cMsgMessage *msg, void *userArg) throw (CodaException) |
User message handler takes care of unknown messages. | |
virtual string | userStatus (void) const throw () |
Gets user status, which should be valid xml fragment. | |
virtual void | daLogMsgFill (cMsgMessage &msg) const throw (CodaException) |
Fills daLogMsg. | |
Protected Attributes | |
string | UDL |
cMsg UDL to connect to run control. | |
string | name |
Coda object name. | |
string | descr |
Coda object description. | |
string | objectType |
Type of this coda object. | |
string | codaClass |
Coda class, specified by user. | |
string | hostName |
Host name. | |
string | userName |
User name. | |
string | state |
Current state, set via changeState() method. | |
string | status |
Current status, set via changeStatus() method. | |
string | config |
Current config, set via changeConfig() method. | |
const cMsgSubscriptionConfig * | myscfg |
cMsg connection subscription config. |
Base class for all CODA objects implements standard functionality.
Connects to run control system, sets up basic callbacks, etc.
CodaObjects have a state than can spontaneously change due to external causes.
NOTE: CodaObjects are by design NOT controllable by the run control system! Use SessionObject if you need to own and control the object. As far as run control is concerned, a CodaObject can only respond to queries.
Definition at line 136 of file CodaObject.hxx.
CodaObject::CodaObject | ( | const string & | udl, | |
const string & | Name, | |||
const string & | Descr, | |||
const string & | cClass = "user" , |
|||
const cMsgSubscriptionConfig * | scfg = NULL , |
|||
int | connTimeout = 10 | |||
) | throw (CodaException) |
CodaObject constructor.
Connects to cMsg system, creates default subscriptions and callbacks.
udl | Main cMsg connection udl | |
name | Object name | |
descr | Object description | |
cClass | Coda class of object | |
scfg | cMsg subscription config | |
connTimeout | connection timeout |
Definition at line 61 of file CodaObject.cc.
References DALOG_ERROR, and DALOG_INFO.
CodaObject::~CodaObject | ( | void | ) | throw () [virtual] |
CodaObject destructor.
Deletes callback dispatcher and closes cMsg connection.
Definition at line 169 of file CodaObject.cc.
void CodaObject::changeState | ( | const string & | newState | ) | throw (CodaException) |
Must be called by the user when the object changes state.
Sets state and informs run control of the new state.
newState | New state |
Definition at line 313 of file CodaObject.cc.
void CodaObject::changeStatus | ( | const string & | newStatus | ) | throw (CodaException) |
Must be called by the user when the object changes status.
Sets status and informs run control of the new status.
newStatus | New status |
Definition at line 236 of file CodaObject.cc.
int CodaObject::daLogMsg | ( | const string & | text, | |
int | sevid, | |||
const string & | daLogSubject = "" | |||
) | const throw (CodaException) |
Called by user to send daLogMsg.
text | Message text | |
sevid | Severity ID code (0 reserved, 1-4 INFO, 5-8 WARN, 9-12 ERROR, 13-14 SEVERE, 15 reserved) | |
daLogSubject | Optional daLogMessage subject |
Definition at line 332 of file CodaObject.cc.
Referenced by codaObject::PollingService::enableInterrupt(), codaObject::linuxTITrigPollingService::enableInterrupt(), and codaObject::RunObject::startProcessing().
void CodaObject::daLogMsgFill | ( | cMsgMessage & | m | ) | const throw (CodaException) [protected, virtual] |
Fills daLogMsg.
m | Message |
Reimplemented in codaObject::RunObject, and codaObject::SessionObject.
Definition at line 414 of file CodaObject.cc.
Referenced by codaObject::SessionObject::daLogMsgFill().
string CodaObject::getCodaClass | ( | void | ) | const throw () |
Returns object coda class.
Definition at line 502 of file CodaObject.cc.
References codaClass.
string CodaObject::getConfig | ( | void | ) | const throw () |
Returns object config.
Reimplemented in codaObject::SessionObject.
Definition at line 554 of file CodaObject.cc.
References config.
string CodaObject::getHostName | ( | void | ) | const throw () |
Returns Host Name.
Definition at line 515 of file CodaObject.cc.
References hostName.
string CodaObject::getObjectType | ( | void | ) | const throw () |
Returns object type.
Definition at line 489 of file CodaObject.cc.
References objectType.
string CodaObject::getState | ( | void | ) | const throw () |
Returns object state.
Definition at line 541 of file CodaObject.cc.
References state.
string CodaObject::getStatus | ( | void | ) | const throw () |
Returns object status.
Definition at line 477 of file CodaObject.cc.
References status.
string CodaObject::getUserName | ( | void | ) | const throw () |
Returns User Name.
Definition at line 528 of file CodaObject.cc.
References userName.
void CodaObject::sendResponse | ( | const cMsgMessage * | msg, | |
const string & | subject, | |||
const string & | type, | |||
const string & | text, | |||
int | userInt | |||
) | const throw (CodaException) [protected, virtual] |
Internal routine creates, fills, and sends response message.
msg | Request message | |
subject | Response subject | |
type | Response type | |
text | Response text | |
userInt | Response user integer |
Definition at line 437 of file CodaObject.cc.
References DALOG_ERROR.
Referenced by startProcessing().
void CodaObject::startProcessing | ( | void | ) | throw (CodaException) [virtual] |
Called to start processing.
Sends initial status message, enables message receipt.
Reimplemented in codaObject::RunObject.
Definition at line 213 of file CodaObject.cc.
References debug, name, rcConn, sendResponse(), and status.
void CodaObject::stopProcessing | ( | void | ) | throw (CodaException) [virtual] |
void CodaObject::userMsgHandler | ( | cMsgMessage * | msg, | |
void * | userArg | |||
) | throw (CodaException) [protected, virtual] |
User message handler takes care of unknown messages.
Default version does nothing, should be overridden by user.
msg | Unknown message | |
userArg | User arg |
Definition at line 569 of file CodaObject.cc.
References DALOG_WARN.
string CodaObject::userStatus | ( | void | ) | const throw () [protected, virtual] |
Gets user status, which should be valid xml fragment.
Default does nothing.
Definition at line 585 of file CodaObject.cc.
string codaObject::CodaObject::codaClass [protected] |
Coda class, specified by user.
Definition at line 185 of file CodaObject.hxx.
Referenced by getCodaClass().
optional daLog message subject.
Definition at line 205 of file CodaObject.hxx.
string codaObject::CodaObject::config [protected] |
Current config, set via changeConfig() method.
Definition at line 190 of file CodaObject.hxx.
Referenced by getConfig().
int CodaObject::debug = 0 [static] |
Global debug flag.
Definition at line 206 of file CodaObject.hxx.
Referenced by codaObject::RunObject::startProcessing(), startProcessing(), stopProcessing(), ~CodaObject(), codaObject::RunObject::~RunObject(), and codaObject::SessionObject::~SessionObject().
string codaObject::CodaObject::descr [protected] |
Coda object description.
Definition at line 182 of file CodaObject.hxx.
string codaObject::CodaObject::hostName [protected] |
const cMsgSubscriptionConfig* codaObject::CodaObject::myscfg [protected] |
cMsg connection subscription config.
Definition at line 192 of file CodaObject.hxx.
string codaObject::CodaObject::name [protected] |
string codaObject::CodaObject::objectType [protected] |
Type of this coda object.
Definition at line 184 of file CodaObject.hxx.
Referenced by getObjectType().
cMsg run control connection object.
Definition at line 196 of file CodaObject.hxx.
Referenced by startProcessing(), stopProcessing(), and ~CodaObject().
string codaObject::CodaObject::state [protected] |
Current state, set via changeState() method.
Definition at line 188 of file CodaObject.hxx.
Referenced by getState().
string codaObject::CodaObject::status [protected] |
Current status, set via changeStatus() method.
Definition at line 189 of file CodaObject.hxx.
Referenced by getStatus(), and startProcessing().
string codaObject::CodaObject::UDL [protected] |
cMsg UDL to connect to run control.
Definition at line 180 of file CodaObject.hxx.
string codaObject::CodaObject::userName [protected] |