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();
35 
37  static DtAdminContent* create();
38 
40  virtual bool init();
41 
43  virtual const DtAdminContentMessageType& type() const;
44 
47  virtual DtAdminContent * clone() const;
48 
50  virtual DtString stringRep() const;
51 
53  virtual int netRepSize() const;
54 
56  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize);
57 
59  virtual bool setToNet();
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
98  {
101 
102  return size;
103  }
104 
106  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize)
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()
116  {
118  char* contentBuffer = netRep() + DtGenericSetRwResponseAdmin::netRepSize();
119  contentBuffer = DtBufferSerialize::encode(myVal, contentBuffer);
120  return true;
121  }
122 
123  virtual DtString stringRep() const
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 
158 
161  {
163  }
164 
165  virtual DtAdminContent * clone() const
166  {
167  return new DtTargetPriorityListResponseAdmin(*this);
168  }
169 
170 };
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 bool setToNet()
Encodes content into buffer.
virtual int netRepSize() const
const DtAdminContentMessageType DtTargetPriorityListResponseAdminType("target-priority-list-response")
static DtAdminContent * create()
Creator function. Returns new instance of this class.
Definition: genericSetRwResponseAdmin.h:160
const DtTemplatedSetRwResponseAdmin & operator=(const DtTemplatedSetRwResponseAdmin< T > &orig)
assignment operator; same as copy costructor.
Definition: genericSetRwResponseAdmin.h:85
virtual int netRepSize() const
Definition: genericSetRwResponseAdmin.h:97
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.
voidpf void uLong size
Definition: ioapi.h:39
virtual bool setToNet()
Encodes content into buffer.
Definition: genericSetRwResponseAdmin.h:115
T myVal
Definition: genericSetRwResponseAdmin.h:141
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Decodes content from buffer.
Definition: genericSetRwResponseAdmin.h:106
Definition: readerWriter.h:85
Definition: vrfObjectMessageTypeTemplate.h:24
virtual DtString stringRep() const
Get a readable string representation of this content.
Definition: genericSetRwResponseAdmin.h:123
DtSetMessageType mySetMessageType
Definition: genericSetRwResponseAdmin.h:68
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Decodes content from buffer.
virtual const DtAdminContentMessageType & type() const
Definition: genericSetRwResponseAdmin.h:157
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 DtAdminContent * clone() const
Make a copy of this content. Returns a pointer to a newly created copy of this class.
Definition: genericSetRwResponseAdmin.h:165
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...
DtAdminContent.
Definition: adminContent.h:23
virtual const DtAdminContentMessageType & type() const =0
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...
DtTargetPriorityListResponseAdmin()
default constructor
Definition: genericSetRwResponseAdmin.h:149
virtual int netRepSize() const
virtual DtString stringRep() const
Get a readable string representation of this content.

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)