DUNE: Uniform Navigational Environment
2016.05.0
|
Basic Entity class, handling only QueryEntityInfo/EntityInfo messages, and implementing the most basic Entity interface.
Public Member Functions | |
BasicEntity (Tasks::AbstractTask *owner, Tasks::Context &context) | |
virtual | ~BasicEntity () |
virtual void | setBindings (Tasks::Recipient *recipient) |
const std::string & | getLabel (void) const |
void | setLabel (const std::string &label) |
unsigned int | getId (void) const |
void | setId (unsigned int id) |
void | reportInfo (void) |
bool | operator== (const std::string label) |
bool | operator== (unsigned int id) |
void | consume (const IMC::QueryEntityInfo *msg) |
void | dispatch (IMC::Message *msg, unsigned int flags=0) |
void | dispatch (IMC::Message &msg, unsigned int flags=0) |
void | dispatchReply (const IMC::Message &original, IMC::Message &msg, unsigned int flags=0) |
Protected Member Functions | |
template<typename M , typename E > | |
void | bind (Tasks::Recipient *recipient, E *ent_obj, void(E::*consumer)(const M *)=&E::consume) |
Protected Attributes | |
Tasks::AbstractTask * | m_owner |
Tasks::Context & | m_ctx |
IMC::EntityInfo | m_ent_info |
|
inline |
Constructor.
[in] | owner | pointer to the task containing the entity. |
[in] | context | entity context. |
|
inlinevirtual |
Destructor.
|
inlineprotected |
Bind a message to a consumer method.
recipient | recipient object. |
ent_obj | consumer entity. |
consumer | consumer method. |
References DUNE::Tasks::Recipient::bind().
void DUNE::Entities::BasicEntity::consume | ( | const IMC::QueryEntityInfo * | msg | ) |
Process QueryEntityInfo message.
[in] | msg | pointer to QueryEntityInfo message. |
References DUNE::Entities::DF_LOOP_BACK, dispatch(), dispatchReply(), DUNE::IMC::Message::getDestinationEntity(), getId(), and m_ent_info.
void DUNE::Entities::BasicEntity::dispatch | ( | IMC::Message * | msg, |
unsigned int | flags = 0 |
||
) |
Dispatch message to the message bus.
[in] | msg | message pointer. |
[in] | flags | bitfield with flags (see Tasks::DispatchFlags). |
References DUNE::Entities::DF_KEEP_TIME, DUNE::Entities::DF_LOOP_BACK, DUNE::IMC::Bus::dispatch(), getId(), DUNE::IMC::AddressResolver::id(), m_ctx, m_owner, DUNE::Tasks::Context::mbus, DUNE::Tasks::Context::resolver, DUNE::IMC::Message::setSource(), DUNE::IMC::Message::setSourceEntity(), and DUNE::IMC::Message::setTimeStamp().
Referenced by consume(), dispatch(), dispatchReply(), DUNE::Entities::StatefulEntity::failActivation(), DUNE::Entities::StatefulEntity::failDeactivation(), DUNE::Control::BottomTracker::onDesiredZ(), DUNE::Control::BottomTracker::onEstimatedState(), DUNE::Entities::StatefulEntity::reportActivationState(), reportInfo(), DUNE::Entities::StatefulEntity::reportState(), DUNE::Entities::StatefulEntity::requestActivation(), DUNE::Entities::StatefulEntity::requestDeactivation(), DUNE::Entities::StatefulEntity::setState(), DUNE::Entities::StatefulEntity::succeedActivation(), and DUNE::Entities::StatefulEntity::succeedDeactivation().
|
inline |
Dispatch message to the message bus.
[in] | msg | message reference. |
[in] | flags | bitfield with flags (see Tasks::DispatchFlags). |
References dispatch().
|
inline |
Dispatch message to the message bus in reply to another message.
[in] | original | original message. |
[in] | msg | message reference. |
[in] | flags | bitfield with flags (see Tasks::DispatchFlags). |
References dispatch(), DUNE::IMC::Message::getSource(), DUNE::IMC::Message::getSourceEntity(), DUNE::IMC::Message::setDestination(), and DUNE::IMC::Message::setDestinationEntity().
Referenced by consume().
|
inline |
Retrieve the entity identifier.
Referenced by consume(), DUNE::Entities::StatefulEntity::consume(), dispatch(), DUNE::Tasks::Task::getEntityId(), operator==(), DUNE::Tasks::Task::reserveEntity(), and DUNE::Entities::StatefulEntity::setState().
|
inline |
Retrieve the entity label.
Referenced by DUNE::Tasks::Task::getEntityLabel(), DUNE::Entities::operator==(), operator==(), DUNE::Tasks::Task::reserveEntities(), and DUNE::Tasks::Task::updateParameters().
|
inline |
Compare label against a string.
[in] | label | string to be compared against. |
References getLabel().
|
inline |
Compare id against an unsigned integer.
[in] | id | integer to use for comparison. |
References getId().
void DUNE::Entities::BasicEntity::reportInfo | ( | void | ) |
Report the entity information by broadcasting an EntityInfo message.
References dispatch(), and m_ent_info.
Referenced by DUNE::Tasks::Task::updateParameters().
|
inlinevirtual |
Set the IMC bindings using the provided recipient object.
[in] | recipient | pointer to the recipient object to use for binding to IMC messages. |
Reimplemented in DUNE::Entities::StatefulEntity.
Referenced by DUNE::Tasks::Task::reserveEntity(), and DUNE::Entities::StatefulEntity::setBindings().
|
inline |
Set the entity identifier.
[in] | id | entity identifier. |
References DUNE::IMC::EntityInfo::id, and m_ent_info.
Referenced by DUNE::Tasks::Task::reserveEntities(), and DUNE::Tasks::Task::reserveEntity().
void DUNE::Entities::BasicEntity::setLabel | ( | const std::string & | label | ) |
Set the entity label.
[in] | label | entity label. |
References DUNE::IMC::EntityInfo::component, DUNE::Tasks::Context::entities, DUNE::Tasks::AbstractTask::getName(), DUNE::IMC::EntityInfo::label, m_ctx, m_ent_info, m_owner, and DUNE::Entities::EntityDataBase::resolve().
Referenced by DUNE::Tasks::Task::reserveEntity(), DUNE::Tasks::Task::setEntityLabel(), and DUNE::Tasks::Task::updateParameters().
|
protected |
Context.
Referenced by dispatch(), and setLabel().
|
protected |
Entity information message.
Referenced by consume(), reportInfo(), DUNE::Entities::StatefulEntity::setActTimes(), setId(), and setLabel().
|
protected |
Owner task.
Referenced by dispatch(), DUNE::Entities::StatefulEntity::requestActivation(), DUNE::Entities::StatefulEntity::requestDeactivation(), and setLabel().