VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
myInterfaceContent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2004 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: myInterfaceContent.h,v $ $Revision: 1.7 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef MyInterfaceContent_H_
10 #define MyInterfaceContent_H_
11 
12 //VR-Forces includes
14 #include <vrfmsgs/messageTypes.h>
15 
16 //VR-Link includes
17 #include <vlutil/vlString.h>
18 #include <vlutil/vlNetTypes.h>
19 
20 //Class MyInterfaceContent
21 //This is an example of a DtSimInterfaceContent subclass which can be
22 //used to send a message from one DtVrfMessageInterface to another
23 //which consists of a string and a number.
24  //8 bytes total
25 
26 //To prevent conflicts with existing VR-Forces messages, increment custom
27 //messages starting at MIN_USER_INTERFACE_MESSAGE_TYPE as defined in
28 //msgTypes.h.
30 
32 {
33 public:
34 
35  //default constructor
37 
38  //destructor
39  virtual ~MyInterfaceContent() override;
40 
41  //copy constructor
43 
44  //assignment operator
46 
47  //Returns the type of interface content (MyInterfaceContentType as defined
48  //above).
49  virtual int type() const override;
50 
51  //Calls the copy constructor to create a clone
52  virtual DtSimInterfaceContent * clone() const override;
53 
54  //Set the message string
55  virtual const DtString & message() const;
56 
57  //Get the message string
58  virtual void setMessage(const DtString & message);
59 
60  //Set the number
61  virtual unsigned int number() const;
62 
63  //Get the number
64  virtual void setNumber(unsigned int number);
65 
66  //See if this is an acknowledgement
67  virtual bool ack() const;
68 
69  //Set if this is an acknowledgement
70  virtual void setAck(bool);
71 
72  //Returns the size of the full network representation padded to an 8-byte
73  //boundary.
74  virtual int netRepSize() const override;
75 
76  //Fills in the message from the network buffer
77  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
78 
79  //Fills in the network buffer with the message contents
80  virtual bool setToNet() override;
81 
82  //Prints the formatted contents of the message into the given string
83  virtual void printDataToString(DtString& str) override;
84 
85  //Static creator function which gets registered with the
86  //DtInterfaceContentFactory
88 
89 protected:
91  DtU32 myNumber;
92  bool myAck;
93 };
94 
95 #endif
DtString myMessage
Definition: myInterfaceContent.h:90
virtual unsigned int number() const
virtual bool setToNet() override
virtual int netRepSize() const override
virtual void printDataToString(DtString &str) override
virtual DtSimInterfaceContent * clone() const override
virtual ~MyInterfaceContent() override
DtU32 myNumber
Definition: myInterfaceContent.h:91
const int MyInterfaceContentType
Definition: myInterfaceContent.h:29
MyInterfaceContent & operator=(const MyInterfaceContent &orig)
virtual void setAck(bool)
virtual const DtString & message() const
Definition: myInterfaceContent.h:31
#define MIN_USER_INTERFACE_MESSAGE_TYPE
Definition: messageTypes.h:32
virtual void setNumber(unsigned int number)
virtual bool ack() const
Definition: simInterfaceContent.h:45
bool myAck
Definition: myInterfaceContent.h:92
virtual void setMessage(const DtString &message)
static DtSimInterfaceContent * creator()
virtual int type() const override
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)