Heartbeat Class Reference

Inheritance diagram for Heartbeat:

Capability List of all members.

Detailed Description

Instantiation of Heartbeat interface.

Please read the documentation for Capabilities for other important functions. Data structures will be placed behind accessor functions in the future.

Definition at line 81 of file Heartbeat.H.

Public Member Functions

 Heartbeat (const std::string &streamname)
 Standard constructor.
 Heartbeat (const ConnectionStrategy &strategy, const std::string &gblName)
 Auto-wiring constructor.
 Heartbeat (const std::string &streamname, const std::string &gblName)
 Like the standard constructor, but explicitly sets the global name.
 ~Heartbeat ()
void init (const std::string &streamname, const ConnectionStrategy &strategy, const std::string &gblName)
 Initialization function, used by above.
void runUpdate ()
 Does all necessary work to update the data/info provided by the object.
void setManager (CommsManager *myManager_)
 Gives the object a reference to the global CORBAHelper.
void setCOMObject (COMBase *object)
 Returns the ID number of the instantiated interface.
void disconnect ()
 Does all necessary work to clean up the object's connection.
void activateSupplier ()
 Sets up the object as a supplier of data.
void activateConsumer ()
 Sets up the object as a consumer of data.
std::string getInterfaceName ()
 Returns the name of the interface.
void setStreamName (const std::string &name)
 Sets the name of the stream we're using.
void setGlobalName (const std::string &name)
 Sets the global name of this object.
bool newData ()
 True if there is new data.
bool newInfo ()
 True if there is new info/requests (depending on supplier/consumer mode).
void setAutoPing (const bool &val)
 Sets the state of the auto-ping function.
void doPing ()
 Manually tells the object to do a ping.
bool getQueueMode ()
 True if events are being queued, otherwise false.
void setQueueMode (const bool &val)
 Turn queue mode on or off.
HeartbeatDataStruct getNextData ()
 Returns a struct containing the next event in the queue.
HeartbeatInfoStruct getNextInfo ()
 Returns a struct containing the next event in the queue.
HeartbeatInfoStruct getNextRequest ()
 Convenience function, calls getNextInfo().
void publishData ()
 Informs the object to publish data on the next update.
void publishInfo ()
 Informs the object to publish info on the next update.

Public Attributes

HeartbeatDataStruct data
 The data structure.
HeartbeatInfoStruct info
 Information-- read if consumer, write if supplier.
HeartbeatInfoStruct requests
 Requests-- read if supplier, write if consumer.

Protected Attributes

COMObject< HeartbeatInfoStruct,
HeartbeatDataStruct > * 
myCOMObject
bool m_queue
bool m_initialize
std::queue< HeartbeatDataStructm_dataVector
std::queue< HeartbeatInfoStructm_infoVector
std::queue< HeartbeatInfoStructm_requestVector


Constructor & Destructor Documentation

Heartbeat ( const std::string &  streamname  )  [explicit]

Standard constructor.

Automatically generates a (hopefully) unique global name. If two of the same (consumer) binaries are running, it *will* fail. This is the only constructor you should use for suppliers.

Definition at line 37 of file Heartbeat.cpp.

References Heartbeat::init(), Capability::m_haveGlobalname, and WURDE::STRAT_NORMAL.

Heartbeat ( const ConnectionStrategy strategy,
const std::string &  gblName 
)

Auto-wiring constructor.

Submits a request to MCP for a stream to connect to, based on global name. ConnectionStrategy should be auto for now.

Definition at line 44 of file Heartbeat.cpp.

References Heartbeat::init(), Capability::m_haveGlobalname, Capability::m_haveStream, and WURDE::STRAT_NORMAL.

Heartbeat ( const std::string &  streamname,
const std::string &  gblName 
)

Like the standard constructor, but explicitly sets the global name.

Use this when starting multiple instances of the same binary, so that each instance can be assigned a separate name.

Definition at line 58 of file Heartbeat.cpp.

References Heartbeat::init(), and WURDE::STRAT_NORMAL.

~Heartbeat (  ) 

Definition at line 102 of file Heartbeat.cpp.

References Heartbeat::myCOMObject, and Capability::myManager.


Member Function Documentation

void init ( const std::string &  streamname,
const ConnectionStrategy strategy,
const std::string &  gblName 
)

Initialization function, used by above.

Definition at line 62 of file Heartbeat.cpp.

References Heartbeat::info, Capability::m_doAutoPing, Capability::m_doPublishData, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, Heartbeat::m_initialize, Heartbeat::m_queue, Capability::m_sourceModule, Capability::m_strategy, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, Heartbeat::myCOMObject, Time::now(), Heartbeat::requests, HeartbeatInfoStruct::source, WURDE::STAT_NULL, HeartbeatInfoStruct::target, and HeartbeatInfoStruct::timestamp.

Referenced by Heartbeat::Heartbeat().

void runUpdate (  )  [virtual]

Does all necessary work to update the data/info provided by the object.

Implements Capability.

Definition at line 247 of file Heartbeat.cpp.

References Capability::m_doPublishData, Capability::m_doPublishInfo, and Heartbeat::myCOMObject.

Referenced by CommsManager::cleanUp(), CommsManager::runUpdate(), and CommsManager::sendInfo().

void setManager ( CommsManager myManager_  )  [virtual]

Gives the object a reference to the global CORBAHelper.

This will be changed soon to be less adaptor specific.

Implements Capability.

Definition at line 258 of file Heartbeat.cpp.

References Heartbeat::myCOMObject, and Capability::myManager.

void setCOMObject ( COMBase object  )  [inline, virtual]

Returns the ID number of the instantiated interface.

Implements Capability.

Definition at line 133 of file Heartbeat.H.

References Heartbeat::myCOMObject.

void disconnect (  )  [inline, virtual]

Does all necessary work to clean up the object's connection.

Implements Capability.

Definition at line 134 of file Heartbeat.H.

References Heartbeat::myCOMObject.

void activateSupplier (  )  [virtual]

Sets up the object as a supplier of data.

Implements Capability.

Definition at line 111 of file Heartbeat.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Heartbeat::data, WURDE::g_fatal(), Heartbeat::info, HeartbeatInfoStruct::interfaces, HeartbeatInfoStruct::locale, Heartbeat::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, Heartbeat::m_infoVector, Heartbeat::m_initialize, Heartbeat::m_queue, Heartbeat::m_requestVector, Capability::m_streamname, Capability::m_supplier, HeartbeatInfoStruct::managedType, HeartbeatInfoStruct::moduleName, Heartbeat::myCOMObject, Heartbeat::requests, Writable::setCMode(), HeartbeatInfoStruct::source, HeartbeatDataStruct::source, HeartbeatInfoStruct::state, and HeartbeatDataStruct::TTL.

Referenced by Heartbeat::setStreamName().

void activateConsumer (  )  [virtual]

Sets up the object as a consumer of data.

Implements Capability.

Definition at line 178 of file Heartbeat.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Heartbeat::data, WURDE::g_fatal(), CommsManager::getName(), HEARTBEAT, Heartbeat::info, HeartbeatInfoStruct::interfaces, HeartbeatInfoStruct::locale, Heartbeat::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, Heartbeat::m_infoVector, Heartbeat::m_initialize, Heartbeat::m_queue, Heartbeat::m_requestVector, Capability::m_strategy, Capability::m_streamname, Capability::m_supplier, HeartbeatInfoStruct::managedType, HeartbeatInfoStruct::moduleName, Heartbeat::myCOMObject, Capability::myManager, Heartbeat::requests, Writable::setCMode(), HeartbeatDataStruct::source, HeartbeatInfoStruct::source, HeartbeatInfoStruct::state, WURDE::STRAT_NORMAL, and HeartbeatDataStruct::TTL.

Referenced by Heartbeat::setStreamName().

std::string getInterfaceName (  )  [inline, virtual]

Returns the name of the interface.

We're identifying interfaces by strings, rather than an enum, as it saves us from having to autogenerate even more code

Implements Capability.

Definition at line 137 of file Heartbeat.H.

References HEARTBEAT.

void setStreamName ( const std::string &  name  )  [virtual]

Sets the name of the stream we're using.

Implements Capability.

Definition at line 639 of file Heartbeat.cpp.

References Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Capability::m_globalname, Capability::m_haveStream, Heartbeat::m_initialize, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, Heartbeat::myCOMObject, and WURDE::STAT_OKAY.

Referenced by CommsManager::initialize(), and CommsManager::setName().

void setGlobalName ( const std::string &  name  )  [virtual]

Sets the global name of this object.

Implements Capability.

Definition at line 667 of file Heartbeat.cpp.

References Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_streamname, Capability::m_supplier, and Heartbeat::myCOMObject.

bool newData (  )  [virtual]

True if there is new data.

Implements Capability.

Definition at line 290 of file Heartbeat.cpp.

References Heartbeat::m_dataVector, Heartbeat::m_queue, and Heartbeat::myCOMObject.

Referenced by main().

bool newInfo (  )  [virtual]

True if there is new info/requests (depending on supplier/consumer mode).

Implements Capability.

Definition at line 302 of file Heartbeat.cpp.

References Heartbeat::m_infoVector, Heartbeat::m_queue, Heartbeat::m_requestVector, Capability::m_supplier, and Heartbeat::myCOMObject.

Referenced by main(), and CommsManager::runUpdate().

void setAutoPing ( const bool &  val  )  [virtual]

Sets the state of the auto-ping function.

If true, consumers will automatically send out a blank MESSAGE_PING to the stream source, and suppliers will automatically filter out these requests and send a copy of the last published info and data.

Should consumers be set up to send out this request on a regular basis?

Implements Capability.

Definition at line 690 of file Heartbeat.cpp.

References Capability::m_doAutoPing, and Heartbeat::myCOMObject.

void doPing (  )  [virtual]

Manually tells the object to do a ping.

If a consumer, sends a ping request to its supplier, if a supplier, sends out a copy of the last published info and data messages.

Implements Capability.

Definition at line 684 of file Heartbeat.cpp.

References Heartbeat::myCOMObject.

bool getQueueMode (  )  [inline]

True if events are being queued, otherwise false.

Definition at line 149 of file Heartbeat.H.

References Heartbeat::m_queue.

void setQueueMode ( const bool &  val  ) 

Turn queue mode on or off.

Definition at line 266 of file Heartbeat.cpp.

References Heartbeat::m_dataVector, Heartbeat::m_infoVector, Heartbeat::m_queue, Heartbeat::m_requestVector, and Heartbeat::myCOMObject.

Referenced by main().

HeartbeatDataStruct getNextData (  ) 

Returns a struct containing the next event in the queue.

Also copies the contents of that event into the data struct.

Definition at line 433 of file Heartbeat.cpp.

References Heartbeat::data, Heartbeat::m_dataVector, Heartbeat::m_queue, Heartbeat::myCOMObject, HeartbeatDataStruct::source, HeartbeatDataStruct::timestamp, and HeartbeatDataStruct::TTL.

Referenced by main().

HeartbeatInfoStruct getNextInfo (  ) 

Returns a struct containing the next event in the queue.

Also copies the contents of that event into the info/requests struct.

Definition at line 457 of file Heartbeat.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Heartbeat::info, HeartbeatInfoStruct::interfaces, HeartbeatInfoStruct::locale, Heartbeat::m_infoVector, Heartbeat::m_queue, Heartbeat::m_requestVector, Capability::m_supplier, HeartbeatInfoStruct::managedType, HeartbeatInfoStruct::moduleName, HeartbeatInfoStruct::mType, Heartbeat::myCOMObject, Heartbeat::requests, Writable::setCMode(), HeartbeatInfoStruct::source, HeartbeatInfoStruct::state, HeartbeatInfoStruct::target, and HeartbeatInfoStruct::timestamp.

Referenced by Heartbeat::getNextRequest(), main(), and CommsManager::runUpdate().

HeartbeatInfoStruct getNextRequest (  )  [inline]

Convenience function, calls getNextInfo().

Definition at line 171 of file Heartbeat.H.

References Heartbeat::getNextInfo().

void publishData (  )  [virtual]

Informs the object to publish data on the next update.

Implements Capability.

Definition at line 319 of file Heartbeat.cpp.

References Heartbeat::data, Heartbeat::m_dataVector, Capability::m_doPublishData, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Heartbeat::m_queue, Capability::m_supplier, Time::now(), HeartbeatDataStruct::source, HeartbeatDataStruct::timestamp, and HeartbeatDataStruct::TTL.

Referenced by CommsManager::runUpdate().

void publishInfo (  )  [virtual]

Informs the object to publish info on the next update.

Implements Capability.

Definition at line 341 of file Heartbeat.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Heartbeat::info, HeartbeatInfoStruct::interfaces, HeartbeatInfoStruct::locale, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Heartbeat::m_infoVector, Heartbeat::m_queue, Heartbeat::m_requestVector, Capability::m_streamname, Capability::m_supplier, HeartbeatInfoStruct::managedType, WURDE::MESSAGE_INFO, WURDE::MESSAGE_REQUEST, HeartbeatInfoStruct::moduleName, HeartbeatInfoStruct::mType, Time::now(), Heartbeat::requests, Writable::setCMode(), HeartbeatInfoStruct::source, HeartbeatInfoStruct::state, HeartbeatInfoStruct::target, and HeartbeatInfoStruct::timestamp.

Referenced by CommsManager::cleanUp(), CommsManager::initialize(), CommsManager::sendInfo(), CommsManager::setIdle(), CommsManager::setQuit(), CommsManager::setReset(), CommsManager::setRestart(), and CommsManager::setRun().


Member Data Documentation

HeartbeatDataStruct data

The data structure.

Read from this if you're a consumer, write to it if you're a supplier.

Definition at line 118 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), CommsManager::CommsManager(), Heartbeat::getNextData(), Heartbeat::publishData(), CommsManager::runUpdate(), CommsManager::setHeartbeatOnly(), and CommsManager::setSleep().

HeartbeatInfoStruct info

Information-- read if consumer, write if supplier.

Definition at line 123 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), CommsManager::cleanUp(), CommsManager::CommsManager(), Heartbeat::getNextInfo(), Heartbeat::init(), CommsManager::initialize(), Heartbeat::publishInfo(), CommsManager::sendInfo(), CommsManager::setIdle(), CommsManager::setInfoState(), CommsManager::setQuit(), CommsManager::setReset(), CommsManager::setRestart(), and CommsManager::setRun().

HeartbeatInfoStruct requests

Requests-- read if supplier, write if consumer.

Definition at line 128 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::getNextInfo(), handleRequest(), Heartbeat::init(), main(), Heartbeat::publishInfo(), CommsManager::runUpdate(), and updateModules().

COMObject<HeartbeatInfoStruct, HeartbeatDataStruct>* myCOMObject [protected]

Definition at line 178 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::disconnect(), Heartbeat::doPing(), Heartbeat::getNextData(), Heartbeat::getNextInfo(), Heartbeat::init(), Heartbeat::newData(), Heartbeat::newInfo(), Heartbeat::runUpdate(), Heartbeat::setAutoPing(), Heartbeat::setCOMObject(), Heartbeat::setGlobalName(), Heartbeat::setManager(), Heartbeat::setQueueMode(), Heartbeat::setStreamName(), and Heartbeat::~Heartbeat().

bool m_queue [protected]

Definition at line 180 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::getNextData(), Heartbeat::getNextInfo(), Heartbeat::getQueueMode(), Heartbeat::init(), Heartbeat::newData(), Heartbeat::newInfo(), Heartbeat::publishData(), Heartbeat::publishInfo(), and Heartbeat::setQueueMode().

bool m_initialize [protected]

Definition at line 183 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::init(), and Heartbeat::setStreamName().

std::queue<HeartbeatDataStruct> m_dataVector [protected]

Definition at line 184 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::getNextData(), Heartbeat::newData(), Heartbeat::publishData(), and Heartbeat::setQueueMode().

std::queue<HeartbeatInfoStruct> m_infoVector [protected]

Definition at line 185 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::getNextInfo(), Heartbeat::newInfo(), Heartbeat::publishInfo(), and Heartbeat::setQueueMode().

std::queue<HeartbeatInfoStruct> m_requestVector [protected]

Definition at line 186 of file Heartbeat.H.

Referenced by Heartbeat::activateConsumer(), Heartbeat::activateSupplier(), Heartbeat::getNextInfo(), Heartbeat::newInfo(), Heartbeat::publishInfo(), and Heartbeat::setQueueMode().


The documentation for this class was generated from the following files:
Generated on Thu Feb 1 15:31:55 2007 for WURDE by  doxygen 1.5.1