VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
genericSetRwResponseAdmin.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include "vrftasks/adminContent.h"
15 
16 class DtReaderWriter;
21 {
22 public:
23 
26 
29 
32 
34  virtual ~DtGenericSetRwResponseAdmin() override;
35 
37  static DtAdminContent* create();
38 
40  virtual bool init() override;
41 
43  virtual const DtAdminContentMessageType& type() const override;
44 
47  virtual DtAdminContent * clone() const override;
48 
50  virtual DtString stringRep() const override;
51 
53  virtual int netRepSize() const override;
54 
56  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
57 
59  virtual bool setToNet() override;
60 
62 
63  virtual void setSetMessageType(const DtSetMessageType& name);
64  virtual const DtSetMessageType& setMessageType() const;
66 
67 protected:
69 };
70 
71 template <class T>
73 {
74 public:
77 
80  , myVal(orig.myVal)
81  {
82  };
83 
86  {
87  if (this != &orig)
88  {
90  myVal = orig.myVal;
91  }
92  return *this;
93  }
94 
95 
97  virtual int netRepSize() const override
98  {
101 
102  return size;
103  }
104 
106  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override
107  {
108  DtGenericSetRwResponseAdmin::setFromNet(contentBuffer, contentSize);
109  contentBuffer += DtGenericSetRwResponseAdmin::netRepSize();
110  contentBuffer = DtBufferSerialize::decode(myVal, contentBuffer);
111  return true;
112  }
113 
115  virtual bool setToNet() override
116  {
118  char* contentBuffer = netRep() + DtGenericSetRwResponseAdmin::netRepSize();
119  contentBuffer = DtBufferSerialize::encode(myVal, contentBuffer);
120  return true;
121  }
122 
123  virtual DtString stringRep() const override
124  {
126  str += " ";
127  str += myVal.prettyPrint();
128  return str;
129  }
130 
131  void setVal(const T & val)
132  {
133  myVal = val;
134  }
135  const T & val() const
136  {
137  return myVal;
138  }
139 
140 protected:
141  T myVal;
142 };
143 
144 
145 class DtTargetPriorityListResponseAdmin : public DtTemplatedSetRwResponseAdmin<DtRwPriorityTargetListMap>
146 {
147 public:
150 
153  {
154  };
155 
157  virtual const DtAdminContentMessageType& type() const override { return DtTargetPriorityListResponseAdminType; };
158 
161  {
163  }
164 
165  virtual DtAdminContent * clone() const override {
166  return new DtTargetPriorityListResponseAdmin(*this);
167  }
168 
169 };
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Sets the contents of this set request based on the network buffer. Base class does nothing and return...
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
void setVal(const T &val)
Definition: genericSetRwResponseAdmin.h:131
const T & val() const
Definition: genericSetRwResponseAdmin.h:135
virtual int netRepSize() const
virtual int netRepSize() const override
Definition: genericSetRwResponseAdmin.h:97
const DtAdminContentMessageType DtTargetPriorityListResponseAdminType("target-priority-list-response")
static DtAdminContent * create()
Creator function. Returns new instance of this class.
Definition: genericSetRwResponseAdmin.h:160
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Decodes content from buffer.
const DtTemplatedSetRwResponseAdmin & operator=(const DtTemplatedSetRwResponseAdmin< T > &orig)
assignment operator; same as copy costructor.
Definition: genericSetRwResponseAdmin.h:85
DtTemplatedSetRwResponseAdmin(const DtTemplatedSetRwResponseAdmin< T > &orig)
copy constructor
Definition: genericSetRwResponseAdmin.h:79
DtTargetPriorityListResponseAdmin(const DtTargetPriorityListResponseAdmin &orig)
copy constructor
Definition: genericSetRwResponseAdmin.h:152
virtual DtAdminContent * clone() const =0
Make a copy of this content. Returns a pointer to a newly created copy of this class. Derived classes must override this function to create and return an instance of the derived type.
virtual bool setToNet() override
Encodes content into buffer.
Definition: genericSetRwResponseAdmin.h:115
virtual int netRepSize() const override
voidpf void uLong size
Definition: ioapi.h:39
T myVal
Definition: genericSetRwResponseAdmin.h:141
Definition: readerWriter.h:85
Definition: vrfObjectMessageTypeTemplate.h:24
DtSetMessageType mySetMessageType
Definition: genericSetRwResponseAdmin.h:68
const DtAdminContent & operator=(const DtAdminContent &orig)
assignment operator; same as copy costructor.
const DtGenericSetRwResponseAdmin & operator=(const DtGenericSetRwResponseAdmin &orig)
assignment operator; same as copy costructor.
virtual DtString stringRep() const override
Get a readable string representation of this content.
Definition: genericSetRwResponseAdmin.h:123
Definition: genericSetRwResponseAdmin.h:72
Admin content for a message that requests the available system lists for an entity The expected respo...
Definition: genericSetRwResponseAdmin.h:20
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
virtual char * netRep()
#define DT_DLL_vrftasks
This file is used to determine how to build.
Definition: vrftasksDefines.h:26
DtTemplatedSetRwResponseAdmin()
default constructor
Definition: genericSetRwResponseAdmin.h:76
virtual bool init()
Base class init does nothing, but this will be called by create, in case any other deriving class nee...
virtual bool setToNet() override
Encodes content into buffer.
DtAdminContent.
Definition: adminContent.h:23
virtual const DtAdminContentMessageType & type() const =0
virtual const DtAdminContentMessageType & type() const override
Definition: genericSetRwResponseAdmin.h:157
virtual bool setToNet()
Sets netRep buffer to the contents of this set request. Base class does nothing and returns true...
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
Definition: genericSetRwResponseAdmin.h:145
virtual DtString stringRep() const =0
Get a readable string representation of this content. Derived classes must implement this function...
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Decodes content from buffer.
Definition: genericSetRwResponseAdmin.h:106
DtTargetPriorityListResponseAdmin()
default constructor
Definition: genericSetRwResponseAdmin.h:149
virtual DtAdminContent * clone() const override
Make a copy of this content. Returns a pointer to a newly created copy of this class.
Definition: genericSetRwResponseAdmin.h:165
virtual DtString stringRep() const override
Get a readable string representation of this content.

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)