VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
chatInterDIS.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 
9 
10 #pragma once
11 
12 #if DtDIS
13 
15 #include <vl/interaction.h>
17 
18 class DtExerciseConn;
19 
20 class DtChatInter;
21 
24 {
25  DtNetPduHeader DtHeader;
26  DtNetEntityIdentifier mySender;
28  DtNetU8 padding1;
29  DtNetU32 padding2;
30  // List of resource entity type follows
31 };
32 
34 typedef void (*DtChatInterInterCb) (DtChatInter* inter,
35  void* usr);
36 
40 {
41 public:
42 
44  DtChatInter(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER);
45 
47  virtual ~DtChatInter() override;
48 
50  DtChatInter(const DtChatInter& orig);
51 
53  DtChatInter& operator=(const DtChatInter& orig);
54 
56  virtual void setSender(const DtEntityIdentifier& val);
57 
59  virtual DtEntityIdentifier sender() const;
60 
62  virtual void setSenderUsername(const std::wstring& val);
63 
65  virtual std::wstring senderUsername() const;
66 
68  virtual void setChannel(const std::wstring& val);
69 
71  virtual std::wstring channel() const;
72 
74  virtual void setForceIdentifier(DtForceType val);
75 
77  virtual DtForceType forceIdentifier() const;
78 
80  virtual void setMessageText(const std::wstring& val);
81 
83  virtual std::wstring messageText() const;
84 
86  virtual const char* name() const { return "DtChatInter"; }
87 
89  virtual void printData() const override;
90 
92  virtual void printDataToStream(std::ostream &stream) const override;
93 
94 public:
95 
98  static DtPdu* create(const DtNetPacket *initial,
99  DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
100 
103  static void addCallback(DtExerciseConn* conn,
104  DtChatInterInterCb cb, void* usr);
105  static void removeCallback(DtExerciseConn* conn,
106  DtChatInterInterCb cb, void* usr);
107 
108 protected:
109 
111  DtChatInter(const DtNetPacket* pkt, DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER, DtPduFactory* pduFactory = 0);
112 
113  // Reads the variable sized data into local storage.
114  virtual void readVariableSizedData();
115 
116  // Returns the number of bytes in the fixed length portion of this PDU
117  virtual unsigned int fixedBytesSize() const;
118 
119  // A pointer to the first byte of variable datums. If there are no variable
120  // datums this points to the first byte out-of-bounds. This address should
121  // only be used if you know the PDU has been resized correctly.
122  virtual char* firstVarDatumStart() const;
123 
124  // Returns the minimum size of this PDU, in bytes. Not virtual because it is
125  // used to initialize the PDU in the constructor.
126  unsigned int minimumSize() const;
127 
128  virtual unsigned netSizeOfWString(const std::wstring& val) const;
129  virtual void writeWString(char* buffer, const std::wstring& val);
130  virtual void readWString(char* buffer, std::wstring& val) const;
131 
132  static DtPduKind internalGetPduKindImpl() { return DtChatPduKind; }
133  virtual DtPduKind internalGetPduKind() const override {
134  return internalGetPduKindImpl();}
135 
136 protected:
137 
138  // Cached values to ensure proper buffering
139  mutable std::wstring mySenderUsername;
140  mutable std::wstring myChannel;
141  mutable std::wstring myMessageText;
142 
143 };
144 
145 DT_DLL_vrfExtObjects std::ostream& operator<< (std::ostream& stream,
146  const DtChatInter& object);
147 
148 #endif
void(* DtChatInterInterCb)(DtChatInter *inter, void *usr)
DtChatInter callback function signature.
Definition: chatInterDIS.h:34
A PDU layout for DtChatInter.
Definition: chatInterDIS.h:23
DtNetPduHeader DtHeader
Definition: chatInterDIS.h:25
std::wstring myMessageText
Definition: chatInterDIS.h:141
static DtPduKind internalGetPduKindImpl()
Definition: chatInterDIS.h:132
DT_DLL_features std::ostream & operator<<(std::ostream &, const DtFeatureTransform &)
std::ostream output.
virtual const char * name() const
Name of the interaction.
Definition: chatInterDIS.h:86
Instances of DtChatInter are used to store state data for resourceRequest interactions.
Definition: chatInterDIS.h:39
DtNetU32 padding2
Definition: chatInterDIS.h:29
std::wstring myChannel
Definition: chatInterDIS.h:140
DtNetEntityIdentifier mySender
Definition: chatInterDIS.h:26
voidpf stream
Definition: ioapi.h:39
const DtPduKind DtChatPduKind
Definition: disEnumsExtensions.h:131
DtNetU8 padding1
Definition: chatInterDIS.h:28
DtNetU8 myForceIdentifier
Definition: chatInterDIS.h:27
virtual DtPduKind internalGetPduKind() const override
Definition: chatInterDIS.h:133
std::wstring mySenderUsername
Definition: chatInterDIS.h:139
#define DT_DLL_vrfExtObjects
Definition: dllExport.h:23

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)