📄 message.hh
字号:
UShort bodySize ; MessageHeaderUnion VP ; // Variable Part };public: // Constructor & Destructor Message(); ~Message(); // Read and Write NetworkMessage Objects to and from Socket objects. void write(SocketUN *Socket) throw (NetworkError, NetworkSignal); void read(SocketUN *Socket) throw (NetworkError, NetworkSignal); // -- Attribute Access Methods // Value Array Management void setValue(int Rank, const char *Value) throw (RTIinternalError); // Bad Rank, Bad Value // If Value == NULL return a newly allocated copy of Value, else copy it // in Value. char *getValue(int Rank, char *Value = 0) const throw (RTIinternalError); // Bad Rank // Return a newly allocated ValueArray, exactly of size HandleArraySize. // containing the actual Attrib/Param values. You must FREE this structure. AttributeValue *getValueArray(); // Strings Access // All the Set* methods check the length of the string, and throw // ValueLengthExceeded if the new string is too long. // All the Get* methods return a pointer on the actual stored value. // This pointer is READ-ONLY, and should not be de-allocated. const char *getLabel() const { return label ; }; void setLabel(const char *new_label); const char *getName() const { return name ; }; void setName(const char *new_name); DimensionHandle getDimension() const { return dimension ; }; void setDimension(DimensionHandle); const char *getFederationName() const { return federationName ; }; void setFederationName(const char *federation_name); const char *getFederateName() const { return federateName ; }; void setFederateName(const char *federate_name); const char *getTag() const { return tag ; }; void setTag(const char *new_tag); SpaceHandle getSpace() const { return space ; }; void setSpace(SpaceHandle); Type getType() const { return type ; }; void setType(Type); unsigned long getNumber() const { return number ; }; void setNumber(unsigned long); long getRegion() const { return region ; }; void setRegion(long); void setFederationTimeDelta(FederationTimeDelta); FederationTimeDelta getFederationTimeDelta() const { return lookahead ; }; void setAttribute(AttributeHandle); AttributeHandle getAttribute() const { return attribute ; }; void setInteractionClass(InteractionClassHandle); InteractionClassHandle getInteractionClass() const { return interactionClass ; }; void setObjectClass(ObjectClassHandle); ObjectClassHandle getObjectClass() const { return objectClass ; }; void setResignAction(ResignAction); ResignAction getResignAction() const { return resignAction ; }; void setFedTime(const FedTime&); FedTime& getFedTime() const { return *(new RTIfedTime(date)); }; void setLookahead(const FedTime&); void setFederationTime(FederationTime); FederationTime getFederationTime() const { return date ; }; void setBoolean(Boolean); Boolean getBoolean() const { return boolean ; }; void setObject(ObjectHandle); ObjectHandle getObject() const { return object ; }; void setTransportation(TransportationHandle); TransportationHandle getTransportation() const { return ((transport == RELIABLE) ? 1 : 0); }; TransportType getTransportType() const { return transport ; }; void setOrdering(OrderingHandle); OrderingHandle getOrdering() const { return ((order == RECEIVE) ? 1 : 0); }; OrderType getOrderType() const { return order ; }; void setEventRetraction(EventRetractionHandle); EventRetractionHandle getEventRetraction() const { return eventRetraction ; }; void setParameter(ParameterHandle); ParameterHandle getParameter() const { return parameter ; }; void setFederate(FederateHandle); FederateHandle getFederate() const { return federate ; }; AttributeHandleSet* getAHS() const ; void setAHS(const AttributeHandleSet &); void setAHS(const AttributeHandle *, int); void setRegions(const RegionImp **, int); AttributeHandleValuePairSet* getAHVPS() const ; void setAHVPS(const AttributeHandleValuePairSet &); ParameterHandleValuePairSet* getPHVPS() const ; void setPHVPS(const ParameterHandleValuePairSet &); void setAttributes(AttributeHandle *, ushort); void setAttributes(AttributeHandle *, AttributeValue *, ushort); void setParameters(ParameterHandle *, ParameterValue *, ushort); void setException(TypeException, const char *the_reason = "\0"); TypeException getExceptionType() const { return exception ; }; const char *getExceptionReason() const { return exceptionReason ; }; // Public attributes Type type ;protected: TypeException exception ; char exceptionReason[MAX_EXCEPTION_REASON_LENGTH + 1] ; FederationTime date ; Boolean boolean ; FederationTimeDelta lookahead ; FederateHandle federate ; ResignAction resignAction ; UShort idCount ; ObjectHandle firstId ; ObjectHandle lastId ; ObjectClassHandle objectClass ; InteractionClassHandle interactionClass ; AttributeHandle attribute ; ParameterHandle parameter ; ObjectHandle object ; TransportType transport ; OrderType order ; EventRetractionHandle eventRetraction ; SpaceHandle space ; DimensionHandle dimension ; // TransportationHandle transportation ; // OrderingHandle ordering ; unsigned long number ; long region ;public: // used for both Attributes and Parameters arrays. UShort handleArraySize ; AttributeHandle handleArray[MAX_ATTRIBUTES_PER_CLASS] ; Message& operator = (const Message&); void display(char *);private: // --------------------- // -- Private Methods --(cf. Message_RW.cc) // --------------------- // Read a Message Body from a Socket. Should be called after // ReadHeader. void readBody(SocketUN *Socket); // Read a Header from a socket, and process it to read its // content. Return RTI_TRUE if the ReadBody Method has to be // called. bool readHeader(SocketUN *Socket); // The message is written onto the socket by WriteHeader if no // body is required, or by WriteBody is a body has been required // by WriteHeader. // Prepare and write a Body to a socket. Should be called after // WriteHeader. void writeBody(SocketUN *Socket); // Prepare and Write a Header to a Socket, and return RTI_TRUE if // the WriteBody method has to be called. bool writeHeader(SocketUN *Socket); // -- Other Private Read Methods -- void readHandleArray(MessageBody *Body); void readLabel(MessageBody *Body); void readName(MessageBody *Body); void readFederationName(MessageBody *Body); void readFederateName(MessageBody *Body); void readResignAction(MessageBody *Body); void readTag(MessageBody *Body); void readValueArray(MessageBody *Body); // -- Other Private Write Methods -- void writeHandleArray(MessageBody *Body); void writeResignAction(MessageBody *Body); void writeValueArray(MessageBody *Body); // ------------------------ // -- Private Attributes -- // ------------------------ MessageHeader header ; char label[MAX_USER_TAG_LENGTH + 1] ; char name[MAX_USER_TAG_LENGTH + 1] ; char federateName[MAX_FEDERATE_NAME_LENGTH + 1] ; char federationName[MAX_FEDERATION_NAME_LENGTH + 1] ; char tag[MAX_USER_TAG_LENGTH + 1] ; AttributeValue valueArray[MAX_ATTRIBUTES_PER_CLASS] ; std::vector<RegionHandle> regions ;};} // namespace certi#endif // _CERTI_MESSAGE_HH// $Id: Message.hh,v 3.23 2004/01/09 16:09:55 breholee Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -