VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simInterfaceContent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: ifaceCont.h,v $ $Revision: 1.10 $ $State: Exp $
7 *******************************************************************************/
8 
9 //
10 // File: ifaceCont.h
11 //
12 // Class: DtSimInterfaceContent
13 //
14 
15 
16 #ifndef DtSimInterfaceContent_H_
17 #define DtSimInterfaceContent_H_
18 
19 #include <vlutil/vlString.h>
21 
22 //
23 // DtSimInterfaceContent is an abstract base class from which real interface
24 // content can be derived. Interface content is the request, response, or other
25 // information provided in an interface message.
26 //
27 // All classes derived from DtSimInterfaceContent must implement a type()
28 // function that returns the type of the interface content as an integer, such as
29 // DtCreate-EntityMessageType or DtPauseControlType.
30 // These are defined in msgTypes.h.
31 // Derived classes must also provide a clone() function that copies their contents.
32 //
33 // Content-Type: Not applicable.
34 //
35 // Parameters: type - The type of interface content, such as "create-entity" or
36 // "pause".
39 
41 
42 // Function for converting content types into strings.
43 typedef const char* (*DtSimInterfaceContentTypePrinterFcn)(int type);
44 
46 {
47 protected:
48  // constructors are protected because no one should instantiate the
49  // base class, just derived versions.
50 
51  // default constructor
53 
54  // copy constructor; nothing to be copied. Here to thwart over-ambitious
55  // compilers that create one when it shouldn't.
57 
58  // assignment operator; same as copy costructor
59  const DtSimInterfaceContent & operator=(const DtSimInterfaceContent & orig);
60 
61 public:
62  virtual ~DtSimInterfaceContent();
63 
64  // Returns the type of Interface Content, such as "create-entity" or "pause".
65  virtual int type() const = 0;
66 
67  virtual DtSimInterfaceContent * clone() const = 0;
68 
69  // Like operator = except it return true if the target data was changed.
70  // Object makes a copy of data and does not take on management, caller is
71  // responsible for deletion.
72  virtual bool update (const DtSimInterfaceContent* data);
73 
74  virtual char* netRep();
75 
76  virtual int netRepSize() const { return 0; }
77 
78  virtual bool setFromNet(const char* contentBuffer,
79  unsigned contentSize)
80  { (void) &contentBuffer; (void) &contentSize;
81  return false; }
82 
83  virtual bool setToNet() { return false; }
84 
85  // Print content type
86  virtual void printContentType(DtString& str);
87 
88  // Print message data
89  virtual void printDataToString(DtString& str);
90 
91  // Indicate whether the interface content should be
92  // sent with the sender's session ID. If this value
93  // is set to true, only those receivers that have the
94  // same session ID as the sender will read the message.
95  // If the value is set the false, every receiver will
96  // read the message, regardless of their session ID.
97  // Currently, only DtVrfObjectDataType messages set
98  // useSessionId to false.
99 
100  virtual void setUseSessionId(bool yesNo);
101  virtual bool useSessionId() const;
102 
103 public:
104  //
105  // Static functions
106  //
107 
108  static DtSimInterfaceContent* createInterfaceContent(int type);
109 
110  static void addInterfaceContentCreatorFcn(int type,
112 
113  static void setFactory(DtInterfaceContentFactory* factory);
114 
115  static DtInterfaceContentFactory* factory();
116 
117  // Registers a function to convert content type to strings.
118  // Used by printContentType(). If not set, the integer value
119  // will be printed.
120  static void registerContentTypePrinter(DtSimInterfaceContentTypePrinterFcn printFcn);
121 
122 protected:
123  virtual char* createNetworkBuffer();
124 
125 protected:
126  char* myNetRep;
128 
129 protected:
130 
132 
134 };
135 
136 
137 #endif
138 
139 
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Definition: simInterfaceContent.h:78
virtual int netRepSize() const
Definition: simInterfaceContent.h:76
char * myNetRep
Definition: simInterfaceContent.h:126
DtSimInterfaceContent *(* DtInterfaceContentCreatorFcn)()
Definition: interfaceContentFactory.h:21
const char *(* DtSimInterfaceContentTypePrinterFcn)(int type)
Definition: simInterfaceContent.h:43
bool myUseSessionId
Definition: simInterfaceContent.h:127
Definition: interfaceContentFactory.h:32
static DtSimInterfaceContentTypePrinterFcn theContentTypePrinterFcn
Definition: simInterfaceContent.h:133
#define DT_DLL_vrfExtProtocol
Definition: vrfExtProtocolDefines.h:23
virtual bool setToNet()
Definition: simInterfaceContent.h:83
Definition: simInterfaceContent.h:45
static DtInterfaceContentFactory * myFactory
Definition: simInterfaceContent.h:131

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)