📄 rtimessage.hpp
字号:
/*** *** See the file "L2_RTI_EO1/disclaimers-and-notices-L2.txt" for *** information on usage and redistribution of this file, *** and for a DISCLAIMER OF ALL WARRANTIES. ***/#ifndef RTIMessage_H#define RTIMessage_H#include "Logging.hpp"/** The op codes used by RTIMessage. */enum livingstone_message_calls { // From Policy to L2 COMMAND, OBSERVATION, FIND_CANDIDATES, PROGRESS, // From Policy to Reporter REPORT_FULL_STATE, REPORT_COMMAND, REPORT_OBSERVATION, REPORT_FIND_CANDIDATES, REPORT_DIAGNOSIS, REPORT_PROGRESS, // From RTITask to L2Task L2_EXIT};/** * A message object used only among tasks within the RTI. * -- WARNING --- * If the size of RTIMessage changes, you *must* change the definition of * RTI_TO_L2_MSG_SIZE in "SCL2L2Interface.h". * \ingroup RTI */class RTIMessage {public: /** * The default constructor is used to create an object that is filled when * the message is dequeued. */ RTIMessage(void) : d_opcode(L2_EXIT),d_variableID(0), d_valueIndex(0) { } /** An exit message has only an opcode. */ RTIMessage(livingstone_message_calls opcode) : d_opcode(opcode), d_variableID(0), d_valueIndex(0) { } /** * Only commands and observations need variable-value pairs. * \param opcode the operation * \param timeTag the time stamp */ RTIMessage(livingstone_message_calls opcode, const TIME_TAG& timeTag) : d_opcode(opcode), d_timeTag(timeTag), d_variableID(0), d_valueIndex(0) { } /** * Commands and observations need variable-value pairs. * \param opcode the op code * \param timeTag the time stamp * \param variableID the L2 Variable ID * \param valueIndex the L2 value index */ RTIMessage(livingstone_message_calls opcode, const TIME_TAG& timeTag, int variableID, int valueIndex) : d_opcode(opcode), d_timeTag(timeTag), d_variableID(variableID), d_valueIndex(valueIndex) { } /** Nothing to do. */ ~RTIMessage() { } /** * Assignment operator * \param livingstoneMesage an RTIMessage object, the rhs of the assignment * \return a reference to this object */ const RTIMessage& operator=(const RTIMessage& livingstoneMessage); /** Return the opcode of the message. */ livingstone_message_calls getOpcode() const { return d_opcode; } /** Return the Livingstone 2 variable ID of the message. */ int getVariableID() const { return d_variableID; } /** Return the Livingstone 2 variable value index of the message. */ int getValueIndex() const { return d_valueIndex; } /** Return the time tag of the message. */ const TIME_TAG& getTimeStamp() const { return d_timeTag; } private: /** The message op code. */ livingstone_message_calls d_opcode; /** The clock time. */ TIME_TAG d_timeTag; /** The Livingstone 2 variable ID number, if applicable. */ int d_variableID; /** The Livingstone 2 variable value index, if applicable. */ int d_valueIndex;};#endif /* RTIMessage_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -