![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2004 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: myInterfaceContent.h,v $ $Revision: 1.7 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00009 #ifndef MyInterfaceContent_H_ 00010 #define MyInterfaceContent_H_ 00011 00012 //VR-Forces includes 00013 #include <vrfExtProtocol/ifaceCont.h> 00014 #include <vrfExtProtocol/msgTypes.h> 00015 00016 //VR-Link includes 00017 #include <vlutil/vlString.h> 00018 #include <vlutil/vlNetTypes.h> 00019 00020 //Class MyInterfaceContent 00021 //This is an example of a DtSimInterfaceContent subclass which can be 00022 //used to send a message from one DtVrfMessageInterface to another 00023 //which consists of a string and a number. 00024 //8 bytes total 00025 00026 //To prevent conflicts with existing VR-Forces messages, increment custom 00027 //messages starting at MIN_USER_INTERFACE_MESSAGE_TYPE as defined in 00028 //msgTypes.h. 00029 const int MyInterfaceContentType = MIN_USER_INTERFACE_MESSAGE_TYPE + 1; 00030 00031 class MyInterfaceContent : public DtSimInterfaceContent 00032 { 00033 public: 00034 00035 //default constructor 00036 MyInterfaceContent(); 00037 00038 //destructor 00039 virtual ~MyInterfaceContent(); 00040 00041 //copy constructor 00042 MyInterfaceContent(const MyInterfaceContent& orig); 00043 00044 //assignment operator 00045 MyInterfaceContent& operator=(const MyInterfaceContent& orig); 00046 00047 //Returns the type of interface content (MyInterfaceContentType as defined 00048 //above). 00049 virtual int type() const; 00050 00051 //Calls the copy constructor to create a clone 00052 virtual DtSimInterfaceContent * clone() const; 00053 00054 //Set the message string 00055 virtual const DtString & message() const; 00056 00057 //Get the message string 00058 virtual void setMessage(const DtString & message); 00059 00060 //Set the number 00061 virtual unsigned int number() const; 00062 00063 //Get the number 00064 virtual void setNumber(unsigned int number); 00065 00066 //See if this is an acknowledgement 00067 virtual bool ack() const; 00068 00069 //Set if this is an acknowledgement 00070 virtual void setAck(bool); 00071 00072 //Returns the size of the full network representation padded to an 8-byte 00073 //boundary. 00074 virtual int netRepSize() const; 00075 00076 //Fills in the message from the network buffer 00077 virtual bool setFromNet(const char* contentBuffer, 00078 unsigned contentSize); 00079 00080 //Fills in the network buffer with the message contents 00081 virtual bool setToNet(); 00082 00083 //Prints the formatted contents of the message into the given string 00084 virtual void printDataToString(DtString& str); 00085 00086 //Static creator function which gets registered with the 00087 //DtInterfaceContentFactory 00088 static DtSimInterfaceContent* creator(); 00089 00090 protected: 00091 DtString myMessage; 00092 DtU32 myNumber; 00093 bool myAck; 00094 }; 00095 00096 #endif