Inheritance diagram for Bumper:
Please read the documentation for Capabilities for other important functions. Data structures will be placed behind accessor functions in the future.
Definition at line 87 of file Bumper.H.
Public Member Functions | |
Bumper (const std::string &streamname) | |
Standard constructor. | |
Bumper (const ConnectionStrategy &strategy, const std::string &gblName) | |
Auto-wiring constructor. | |
Bumper (const std::string &streamname, const std::string &gblName) | |
Like the standard constructor, but explicitly sets the global name. | |
~Bumper () | |
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. | |
BumperDataStruct | getNextData () |
Returns a struct containing the next event in the queue. | |
BumperInfoStruct | getNextInfo () |
Returns a struct containing the next event in the queue. | |
BumperInfoStruct | 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 | |
BumperDataStruct | data |
The data structure. | |
BumperInfoStruct | info |
Information-- read if consumer, write if supplier. | |
BumperInfoStruct | requests |
Requests-- read if supplier, write if consumer. | |
Protected Attributes | |
COMObject< BumperInfoStruct, BumperDataStruct > * | myCOMObject |
bool | m_queue |
bool | m_initialize |
std::queue< BumperDataStruct > | m_dataVector |
std::queue< BumperInfoStruct > | m_infoVector |
std::queue< BumperInfoStruct > | m_requestVector |
Bumper | ( | 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 Bumper.cpp.
References Bumper::init(), Capability::m_haveGlobalname, and WURDE::STRAT_NORMAL.
Bumper | ( | 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 Bumper.cpp.
References Bumper::init(), Capability::m_haveGlobalname, Capability::m_haveStream, and WURDE::STRAT_NORMAL.
Bumper | ( | 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 Bumper.cpp.
References Bumper::init(), and WURDE::STRAT_NORMAL.
~Bumper | ( | ) |
Definition at line 102 of file Bumper.cpp.
References Bumper::myCOMObject, and Capability::myManager.
void init | ( | const std::string & | streamname, | |
const ConnectionStrategy & | strategy, | |||
const std::string & | gblName | |||
) |
Initialization function, used by above.
Definition at line 62 of file Bumper.cpp.
References Bumper::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, Bumper::m_initialize, Bumper::m_queue, Capability::m_sourceModule, Capability::m_strategy, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, Bumper::myCOMObject, Time::now(), Bumper::requests, BumperInfoStruct::source, WURDE::STAT_NULL, BumperInfoStruct::target, and BumperInfoStruct::timestamp.
Referenced by Bumper::Bumper().
void runUpdate | ( | ) | [virtual] |
Does all necessary work to update the data/info provided by the object.
Implements Capability.
Definition at line 339 of file Bumper.cpp.
References Capability::m_doPublishData, Capability::m_doPublishInfo, and Bumper::myCOMObject.
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 350 of file Bumper.cpp.
References Bumper::myCOMObject, and Capability::myManager.
void setCOMObject | ( | COMBase * | object | ) | [inline, virtual] |
Returns the ID number of the instantiated interface.
Implements Capability.
Definition at line 139 of file Bumper.H.
References Bumper::myCOMObject.
void disconnect | ( | ) | [inline, virtual] |
Does all necessary work to clean up the object's connection.
Implements Capability.
Definition at line 140 of file Bumper.H.
References Bumper::myCOMObject.
void activateSupplier | ( | ) | [virtual] |
Sets up the object as a supplier of data.
Implements Capability.
Definition at line 111 of file Bumper.cpp.
References BumperDataStruct::bumped, BumperDataStruct::bumpers, WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Bumper::data, WURDE::g_fatal(), Bumper::info, Bumper::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, Bumper::m_infoVector, Bumper::m_initialize, Bumper::m_queue, Bumper::m_requestVector, Capability::m_streamname, Capability::m_supplier, Bumper::myCOMObject, BumperInfoStruct::phi_offset, BumperInfoStruct::phi_separation, BumperInfoStruct::psi_offset, BumperInfoStruct::psi_separation, Bumper::requests, BumperInfoStruct::sensor_positions, Writable::setCMode(), BumperInfoStruct::source, BumperDataStruct::source, BumperInfoStruct::theta_offset, BumperInfoStruct::theta_separation, BumperInfoStruct::uniform, BumperInfoStruct::x_offset, BumperInfoStruct::x_separation, BumperInfoStruct::y_offset, BumperInfoStruct::y_separation, BumperInfoStruct::z_offset, and BumperInfoStruct::z_separation.
Referenced by Bumper::setStreamName().
void activateConsumer | ( | ) | [virtual] |
Sets up the object as a consumer of data.
Implements Capability.
Definition at line 224 of file Bumper.cpp.
References BumperDataStruct::bumped, BUMPER, BumperDataStruct::bumpers, WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Bumper::data, WURDE::g_fatal(), CommsManager::getName(), Bumper::info, Bumper::m_dataVector, Capability::m_doAutoPing, Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_haveStream, Bumper::m_infoVector, Bumper::m_initialize, Bumper::m_queue, Bumper::m_requestVector, Capability::m_strategy, Capability::m_streamname, Capability::m_supplier, Bumper::myCOMObject, Capability::myManager, BumperInfoStruct::phi_offset, BumperInfoStruct::phi_separation, BumperInfoStruct::psi_offset, BumperInfoStruct::psi_separation, Bumper::requests, BumperInfoStruct::sensor_positions, Writable::setCMode(), BumperDataStruct::source, BumperInfoStruct::source, WURDE::STRAT_NORMAL, BumperInfoStruct::theta_offset, BumperInfoStruct::theta_separation, BumperInfoStruct::uniform, BumperInfoStruct::x_offset, BumperInfoStruct::x_separation, BumperInfoStruct::y_offset, BumperInfoStruct::y_separation, BumperInfoStruct::z_offset, and BumperInfoStruct::z_separation.
Referenced by Bumper::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 143 of file Bumper.H.
References BUMPER.
void setStreamName | ( | const std::string & | name | ) | [virtual] |
Sets the name of the stream we're using.
Implements Capability.
Definition at line 1041 of file Bumper.cpp.
References Bumper::activateConsumer(), Bumper::activateSupplier(), Capability::m_globalname, Capability::m_haveStream, Bumper::m_initialize, Capability::m_streamname, Capability::m_streamRequest, Capability::m_supplier, Bumper::myCOMObject, and WURDE::STAT_OKAY.
void setGlobalName | ( | const std::string & | name | ) | [virtual] |
Sets the global name of this object.
Implements Capability.
Definition at line 1069 of file Bumper.cpp.
References Capability::m_globalname, Capability::m_haveGlobalname, Capability::m_streamname, Capability::m_supplier, and Bumper::myCOMObject.
bool newData | ( | ) | [virtual] |
True if there is new data.
Implements Capability.
Definition at line 382 of file Bumper.cpp.
References Bumper::m_dataVector, Bumper::m_queue, and Bumper::myCOMObject.
bool newInfo | ( | ) | [virtual] |
True if there is new info/requests (depending on supplier/consumer mode).
Implements Capability.
Definition at line 394 of file Bumper.cpp.
References Bumper::m_infoVector, Bumper::m_queue, Bumper::m_requestVector, Capability::m_supplier, and Bumper::myCOMObject.
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 1092 of file Bumper.cpp.
References Capability::m_doAutoPing, and Bumper::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 1086 of file Bumper.cpp.
References Bumper::myCOMObject.
bool getQueueMode | ( | ) | [inline] |
True if events are being queued, otherwise false.
Definition at line 155 of file Bumper.H.
References Bumper::m_queue.
void setQueueMode | ( | const bool & | val | ) |
Turn queue mode on or off.
Definition at line 358 of file Bumper.cpp.
References Bumper::m_dataVector, Bumper::m_infoVector, Bumper::m_queue, Bumper::m_requestVector, and Bumper::myCOMObject.
BumperDataStruct 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 590 of file Bumper.cpp.
References BumperDataStruct::bumped, BumperDataStruct::bumpers, Bumper::data, Bumper::m_dataVector, Bumper::m_queue, Bumper::myCOMObject, BumperDataStruct::source, and BumperDataStruct::timestamp.
BumperInfoStruct 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 616 of file Bumper.cpp.
References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Bumper::info, Bumper::m_infoVector, Bumper::m_queue, Bumper::m_requestVector, Capability::m_supplier, BumperInfoStruct::mType, Bumper::myCOMObject, BumperInfoStruct::phi_offset, BumperInfoStruct::phi_separation, BumperInfoStruct::psi_offset, BumperInfoStruct::psi_separation, Bumper::requests, BumperInfoStruct::sensor_positions, Writable::setCMode(), BumperInfoStruct::source, BumperInfoStruct::target, BumperInfoStruct::theta_offset, BumperInfoStruct::theta_separation, BumperInfoStruct::timestamp, BumperInfoStruct::uniform, BumperInfoStruct::x_offset, BumperInfoStruct::x_separation, BumperInfoStruct::y_offset, BumperInfoStruct::y_separation, BumperInfoStruct::z_offset, and BumperInfoStruct::z_separation.
Referenced by Bumper::getNextRequest().
BumperInfoStruct getNextRequest | ( | ) | [inline] |
Convenience function, calls getNextInfo().
Definition at line 177 of file Bumper.H.
References Bumper::getNextInfo().
void publishData | ( | ) | [virtual] |
Informs the object to publish data on the next update.
Implements Capability.
Definition at line 411 of file Bumper.cpp.
References BumperDataStruct::bumped, BumperDataStruct::bumpers, Bumper::data, Bumper::m_dataVector, Capability::m_doPublishData, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Bumper::m_queue, Capability::m_supplier, Time::now(), BumperDataStruct::source, and BumperDataStruct::timestamp.
void publishInfo | ( | ) | [virtual] |
Informs the object to publish info on the next update.
Implements Capability.
Definition at line 435 of file Bumper.cpp.
References WURDE::C_CONSUMER, WURDE::C_SUPPLIER, Bumper::info, Capability::m_doPublishInfo, Capability::m_doTag, Capability::m_doTimestamp, Capability::m_globalname, Bumper::m_infoVector, Bumper::m_queue, Bumper::m_requestVector, Capability::m_streamname, Capability::m_supplier, WURDE::MESSAGE_INFO, WURDE::MESSAGE_REQUEST, BumperInfoStruct::mType, Time::now(), BumperInfoStruct::phi_offset, BumperInfoStruct::phi_separation, BumperInfoStruct::psi_offset, BumperInfoStruct::psi_separation, Bumper::requests, BumperInfoStruct::sensor_positions, Writable::setCMode(), BumperInfoStruct::source, BumperInfoStruct::target, BumperInfoStruct::theta_offset, BumperInfoStruct::theta_separation, BumperInfoStruct::timestamp, BumperInfoStruct::uniform, BumperInfoStruct::x_offset, BumperInfoStruct::x_separation, BumperInfoStruct::y_offset, BumperInfoStruct::y_separation, BumperInfoStruct::z_offset, and BumperInfoStruct::z_separation.
The data structure.
Read from this if you're a consumer, write to it if you're a supplier.
Definition at line 124 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextData(), and Bumper::publishData().
Information-- read if consumer, write if supplier.
Definition at line 129 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextInfo(), Bumper::init(), and Bumper::publishInfo().
Requests-- read if supplier, write if consumer.
Definition at line 134 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextInfo(), Bumper::init(), and Bumper::publishInfo().
COMObject<BumperInfoStruct, BumperDataStruct>* myCOMObject [protected] |
Definition at line 184 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::disconnect(), Bumper::doPing(), Bumper::getNextData(), Bumper::getNextInfo(), Bumper::init(), Bumper::newData(), Bumper::newInfo(), Bumper::runUpdate(), Bumper::setAutoPing(), Bumper::setCOMObject(), Bumper::setGlobalName(), Bumper::setManager(), Bumper::setQueueMode(), Bumper::setStreamName(), and Bumper::~Bumper().
bool m_queue [protected] |
Definition at line 186 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextData(), Bumper::getNextInfo(), Bumper::getQueueMode(), Bumper::init(), Bumper::newData(), Bumper::newInfo(), Bumper::publishData(), Bumper::publishInfo(), and Bumper::setQueueMode().
bool m_initialize [protected] |
Definition at line 189 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::init(), and Bumper::setStreamName().
std::queue<BumperDataStruct> m_dataVector [protected] |
Definition at line 190 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextData(), Bumper::newData(), Bumper::publishData(), and Bumper::setQueueMode().
std::queue<BumperInfoStruct> m_infoVector [protected] |
Definition at line 191 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextInfo(), Bumper::newInfo(), Bumper::publishInfo(), and Bumper::setQueueMode().
std::queue<BumperInfoStruct> m_requestVector [protected] |
Definition at line 192 of file Bumper.H.
Referenced by Bumper::activateConsumer(), Bumper::activateSupplier(), Bumper::getNextInfo(), Bumper::newInfo(), Bumper::publishInfo(), and Bumper::setQueueMode().