McpRequest Class Reference

Inheritance diagram for McpRequest:

Capability List of all members.

Detailed Description

Instantiation of McpRequest 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 79 of file McpRequest.H.

Public Member Functions

 McpRequest (const std::string &streamname)
 Standard constructor.
 McpRequest (const ConnectionStrategy &strategy, const std::string &gblName)
 Auto-wiring constructor.
 McpRequest (const std::string &streamname, const std::string &gblName)
 Like the standard constructor, but explicitly sets the global name.
 ~McpRequest ()
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.
McpRequestDataStruct getNextData ()
 Returns a struct containing the next event in the queue.
McpRequestInfoStruct getNextInfo ()
 Returns a struct containing the next event in the queue.
McpRequestInfoStruct 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

McpRequestDataStruct data
 The data structure.
McpRequestInfoStruct info
 Information-- read if consumer, write if supplier.
McpRequestInfoStruct requests
 Requests-- read if supplier, write if consumer.

Protected Attributes

COMObject< McpRequestInfoStruct,
McpRequestDataStruct > * 
myCOMObject
bool m_queue
bool m_initialize
std::queue< McpRequestDataStructm_dataVector
std::queue< McpRequestInfoStructm_infoVector
std::queue< McpRequestInfoStructm_requestVector


Constructor & Destructor Documentation

McpRequest ( 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 McpRequest.cpp.

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

McpRequest ( 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 McpRequest.cpp.

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

McpRequest ( 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 McpRequest.cpp.

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

~McpRequest (  ) 

Definition at line 102 of file McpRequest.cpp.

References McpRequest::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 McpRequest.cpp.

References McpRequest::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, McpRequest::m_initialize, McpRequest::m_queue, Capability::m_sourceModule, Capability::m_strategy, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, McpRequest::myCOMObject, Time::now(), McpRequest::requests, McpRequestInfoStruct::source, WURDE::STAT_NULL, McpRequestInfoStruct::target, and McpRequestInfoStruct::timestamp.

Referenced by McpRequest::McpRequest().

void runUpdate (  )  [virtual]

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

Implements Capability.

Definition at line 255 of file McpRequest.cpp.

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

Referenced by CommsManager::runUpdate().

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 266 of file McpRequest.cpp.

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

void setCOMObject ( COMBase object  )  [inline, virtual]

Returns the ID number of the instantiated interface.

Implements Capability.

Definition at line 131 of file McpRequest.H.

References McpRequest::myCOMObject.

void disconnect (  )  [inline, virtual]

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

Implements Capability.

Definition at line 132 of file McpRequest.H.

References McpRequest::myCOMObject.

void activateSupplier (  )  [virtual]

Sets up the object as a supplier of data.

Implements Capability.

Definition at line 111 of file McpRequest.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, McpRequest::data, WURDE::g_fatal(), McpRequestInfoStruct::gblname, McpRequest::info, McpRequest::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, McpRequest::m_infoVector, McpRequest::m_initialize, McpRequest::m_queue, McpRequest::m_requestVector, Capability::m_streamname, Capability::m_supplier, McpRequest::myCOMObject, McpRequest::requests, McpRequestInfoStruct::robotModule, Writable::setCMode(), McpRequestInfoStruct::source, McpRequestDataStruct::source, McpRequestInfoStruct::status, McpRequestInfoStruct::strategy, McpRequestInfoStruct::stream, and McpRequestInfoStruct::type.

Referenced by McpRequest::setStreamName().

void activateConsumer (  )  [virtual]

Sets up the object as a consumer of data.

Implements Capability.

Definition at line 182 of file McpRequest.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, McpRequest::data, WURDE::g_fatal(), McpRequestInfoStruct::gblname, CommsManager::getName(), McpRequest::info, McpRequest::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, McpRequest::m_infoVector, McpRequest::m_initialize, McpRequest::m_queue, McpRequest::m_requestVector, Capability::m_strategy, Capability::m_streamname, Capability::m_supplier, MCPREQUEST, McpRequest::myCOMObject, Capability::myManager, McpRequest::requests, McpRequestInfoStruct::robotModule, Writable::setCMode(), McpRequestDataStruct::source, McpRequestInfoStruct::source, McpRequestInfoStruct::status, WURDE::STRAT_NORMAL, McpRequestInfoStruct::strategy, McpRequestInfoStruct::stream, and McpRequestInfoStruct::type.

Referenced by McpRequest::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 135 of file McpRequest.H.

References MCPREQUEST.

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

Sets the name of the stream we're using.

Implements Capability.

Definition at line 681 of file McpRequest.cpp.

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

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

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

Sets the global name of this object.

Implements Capability.

Definition at line 709 of file McpRequest.cpp.

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

Referenced by main().

bool newData (  )  [virtual]

True if there is new data.

Implements Capability.

Definition at line 298 of file McpRequest.cpp.

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

bool newInfo (  )  [virtual]

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

Implements Capability.

Definition at line 310 of file McpRequest.cpp.

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

Referenced by CommsManager::handleMCP().

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 732 of file McpRequest.cpp.

References Capability::m_doAutoPing, and McpRequest::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 726 of file McpRequest.cpp.

References McpRequest::myCOMObject.

bool getQueueMode (  )  [inline]

True if events are being queued, otherwise false.

Definition at line 147 of file McpRequest.H.

References McpRequest::m_queue.

void setQueueMode ( const bool &  val  ) 

Turn queue mode on or off.

Definition at line 274 of file McpRequest.cpp.

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

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

McpRequestDataStruct 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 448 of file McpRequest.cpp.

References McpRequest::data, McpRequest::m_dataVector, McpRequest::m_queue, McpRequest::myCOMObject, McpRequestDataStruct::source, McpRequestDataStruct::state, McpRequestDataStruct::target, and McpRequestDataStruct::timestamp.

McpRequestInfoStruct 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 472 of file McpRequest.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, McpRequestInfoStruct::gblname, McpRequest::info, McpRequest::m_infoVector, McpRequest::m_queue, McpRequest::m_requestVector, Capability::m_supplier, McpRequestInfoStruct::mType, McpRequest::myCOMObject, McpRequest::requests, McpRequestInfoStruct::robotModule, Writable::setCMode(), McpRequestInfoStruct::source, McpRequestInfoStruct::status, McpRequestInfoStruct::strategy, McpRequestInfoStruct::stream, McpRequestInfoStruct::target, McpRequestInfoStruct::timestamp, and McpRequestInfoStruct::type.

Referenced by McpRequest::getNextRequest(), and CommsManager::handleMCP().

McpRequestInfoStruct getNextRequest (  )  [inline]

Convenience function, calls getNextInfo().

Definition at line 169 of file McpRequest.H.

References McpRequest::getNextInfo().

Referenced by main().

void publishData (  )  [virtual]

Informs the object to publish data on the next update.

Implements Capability.

Definition at line 327 of file McpRequest.cpp.

References McpRequest::data, McpRequest::m_dataVector, Capability::m_doPublishData, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, McpRequest::m_queue, Capability::m_supplier, Time::now(), McpRequestDataStruct::source, McpRequestDataStruct::state, McpRequestDataStruct::target, and McpRequestDataStruct::timestamp.

void publishInfo (  )  [virtual]

Informs the object to publish info on the next update.

Implements Capability.

Definition at line 349 of file McpRequest.cpp.

References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, McpRequestInfoStruct::gblname, McpRequest::info, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, McpRequest::m_infoVector, McpRequest::m_queue, McpRequest::m_requestVector, Capability::m_streamname, Capability::m_supplier, WURDE::MESSAGE_INFO, WURDE::MESSAGE_REQUEST, McpRequestInfoStruct::mType, Time::now(), McpRequest::requests, McpRequestInfoStruct::robotModule, Writable::setCMode(), McpRequestInfoStruct::source, McpRequestInfoStruct::status, McpRequestInfoStruct::strategy, McpRequestInfoStruct::stream, McpRequestInfoStruct::target, McpRequestInfoStruct::timestamp, and McpRequestInfoStruct::type.

Referenced by main().


Member Data Documentation

McpRequestDataStruct data

The data structure.

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

Definition at line 116 of file McpRequest.H.

Referenced by McpRequest::activateConsumer(), McpRequest::activateSupplier(), McpRequest::getNextData(), and McpRequest::publishData().

McpRequestInfoStruct info

Information-- read if consumer, write if supplier.

Definition at line 121 of file McpRequest.H.

Referenced by McpRequest::activateConsumer(), McpRequest::activateSupplier(), McpRequest::getNextInfo(), CommsManager::handleMCP(), CommsManager::handleMCPReply(), McpRequest::init(), main(), and McpRequest::publishInfo().

McpRequestInfoStruct requests

Requests-- read if supplier, write if consumer.

Definition at line 126 of file McpRequest.H.

Referenced by McpRequest::activateConsumer(), McpRequest::activateSupplier(), McpRequest::getNextInfo(), CommsManager::handleMCP(), McpRequest::init(), McpRequest::publishInfo(), and CommsManager::updateObjects().

COMObject<McpRequestInfoStruct, McpRequestDataStruct>* myCOMObject [protected]

Definition at line 176 of file McpRequest.H.

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

bool m_queue [protected]

Definition at line 178 of file McpRequest.H.

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

bool m_initialize [protected]

Definition at line 181 of file McpRequest.H.

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

std::queue<McpRequestDataStruct> m_dataVector [protected]

Definition at line 182 of file McpRequest.H.

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

std::queue<McpRequestInfoStruct> m_infoVector [protected]

Definition at line 183 of file McpRequest.H.

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

std::queue<McpRequestInfoStruct> m_requestVector [protected]

Definition at line 184 of file McpRequest.H.

Referenced by McpRequest::activateConsumer(), McpRequest::activateSupplier(), McpRequest::getNextInfo(), McpRequest::newInfo(), McpRequest::publishInfo(), and McpRequest::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