VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
persistentTracksCommand.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "vrfplan/simCommand.h"
12 #include "vrfplan/vrfplanDefines.h"
13 #include "vrfutil/rwKeyValueList.h"
14 #include "vrfutil/rwVectorList.h"
15 
16 #include <readerWriter/rwInt.h>
17 #include <readerWriter/rwReal.h>
18 
22 {
23 public:
26 
28  DtPersistentTracksCommand(const DtString& writeName,
29  DtReaderWriterRegistry* parentRegistry = NULL);
30 
32  DtPersistentTracksCommand(const DtString & writeName, const DtPersistentTracksCommand& orig,
33  DtReaderWriterRegistry* parentRegistry = NULL);
34 
36  virtual ~DtPersistentTracksCommand() override;
37 
40 
42  virtual DtString stringRep() const override = 0; //Purely virtual due to different string reps
43  virtual int netRepSize() const override;
44 
46  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
47 
49  virtual bool setToNet() override;
50 
52 
53  virtual const DtRwVectorList& vertices() const;
54  virtual void addVertexToVector(const DtRwVector&);
55  virtual void setVertices(const DtRwVectorList&);
57 
58 protected:
60 
61 };
62 
63 template<class CommandType>
65 {
66  return new CommandType();
67 }
68 
72 {
73 public:
75  static std::vector<DtString> theTrackTypesStringRep;
76  static std::vector<DtString> theTrackDepthsStringRep;
77  static std::vector<DtString> theTrackAmountsStringRep;
78 
80  static DtString getTrackType(int);
81  static int getTrackType(const DtString&);
82 
83  static DtString getTrackDepth(int);
84  static int getTrackDepth(const DtString&);
85 
86  static DtString getTrackAmount(int);
87  static int getTrackAmount(const DtString&);
88 
91 
93  DtAddPersistentTracksCommand(const DtString& writeName,
94  DtReaderWriterRegistry* parentRegistry = NULL);
95 
97  DtAddPersistentTracksCommand(const DtString & writeName,
98  const DtAddPersistentTracksCommand& orig,
99  DtReaderWriterRegistry* parentRegistry = NULL);
100 
102  virtual ~DtAddPersistentTracksCommand() override {};
103 
106 
108 
109  virtual void setTrackType(DtString);
110  virtual DtString trackType() const;
112 
114 
115  virtual void setTrackAmount(DtString);
116  virtual DtString trackAmount() const;
118 
120 
121  virtual void setTrackDepth(DtString);
122  virtual DtString trackDepth() const;
124 
126  virtual DtString stringRep() const override;
127  virtual int netRepSize() const override;
128 
130  virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
131 
133  virtual bool setToNet() override;
134 
135  virtual const DtSimCommandMessageType& type() const override { return DtAddPersistentTracksCommandType; }
136 
137  virtual DtSimCommand* clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0) const override
138  {
139  return new DtAddPersistentTracksCommand(name, *this, parentRegistry);
140  }
141 
142 protected:
146 
147 };
148 
152 {
153 public:
156 
159  DtReaderWriterRegistry* parentRegistry = NULL)
160  : DtPersistentTracksCommand(writeName, parentRegistry) {};
161 
164  DtReaderWriterRegistry* parentRegistry = NULL)
165  : DtPersistentTracksCommand(writeName, orig, parentRegistry) {};
166 
168  virtual ~DtRemovePersistentTracksCommand() override {};
169 
171  virtual DtString stringRep() const override;
172 
173  virtual const DtSimCommandMessageType& type() const override { return DtRemovePersistentTracksCommandType; }
174 
175  virtual DtSimCommand* clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0) const override
176  {
177  return new DtRemovePersistentTracksCommand(name, *this, parentRegistry);
178  }
179 };
virtual ~DtAddPersistentTracksCommand() override
Destructor.
Definition: persistentTracksCommand.h:102
DtPersistentTracksCommand & operator=(const DtPersistentTracksCommand &)
Assignment operator.
DtRemovePersistentTracksCommand(const DtString &writeName, const DtRemovePersistentTracksCommand &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Copy constructor.
Definition: persistentTracksCommand.h:163
virtual bool setToNet()
Calls netRep() to create the network buffer. Casts the resulting myNetRep to type DtNetSimSimCommand*...
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const override
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: persistentTracksCommand.h:175
DtSimCommand * persistentTracksCommandCreator()
Definition: persistentTracksCommand.h:64
Description: Readable, Writable DtString Variable substitutions are done on this object when it is re...
Definition: rwString.h:20
virtual const DtSimCommandMessageType & type() const override
Definition: persistentTracksCommand.h:173
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Sets mySubsimCommand member from the incoming contentBuffer (cast to type DtNetSimSimCommand). Derived classes should call down to this function first, and then extract their own data starting at the location contentBuffer + DtSimCommand::netRepSize().
virtual DtString stringRep() const =0
Returns a human-readable string representation of the command. This string representation is used to ...
Definition: readerWriterRegistry.h:39
virtual bool setToNet() override
Calls netRep() to create the network buffer. Casts the resulting myNetRep to type DtNetSimSimCommand*...
DtRwString myTrackType
Definition: persistentTracksCommand.h:143
const DtSimCommandMessageType DtAddPersistentTracksCommandType("add-persistent-tracks-command")
DtSimCommand which causes a specific list of dynamic terrain changes to take place at the specified g...
Definition: persistentTracksCommand.h:71
virtual DtString stringRep() const override=0
Command type (string)
Definition: rwVector.h:23
static std::vector< DtString > theTrackAmountsStringRep
Definition: persistentTracksCommand.h:77
virtual const DtSimCommandMessageType & type() const override
Definition: persistentTracksCommand.h:135
DtSimCommand which causes a specific list of dynamic terrain changes to take place at the specified g...
Definition: persistentTracksCommand.h:151
virtual int netRepSize() const
Returns the size in bytes of the network representation of the class. This is the size in bytes of th...
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize)
Sets mySubsimCommand member from the incoming contentBuffer (cast to type DtNetSimSimCommand). Derived classes should call down to this function first, and then extract their own data starting at the location contentBuffer + DtSimCommand::netRepSize().
const DtSimCommandMessageType DtRemovePersistentTracksCommandType("remove-persistent-tracks-command")
DtRwVectorList myVertices
Definition: persistentTracksCommand.h:59
const DtSimCommand & operator=(const DtSimCommand &orig)
assignment operator; same as copy constructor
virtual DtSimCommand * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const override
Make a copy of this sim command. Returns a newly allocated instance of a DtSimCommand. Override this member function to return a pointer to a newly allocated instance of the derived class.
Definition: persistentTracksCommand.h:137
DtSimCommand is an abstract base class from which commands can derive. It manages the read/write capa...
Definition: simCommand.h:32
DtRwString myTrackDepth
Definition: persistentTracksCommand.h:145
Base class for any DtSimCommand which persistent changes to be added or removed. Must be subclassed f...
Definition: persistentTracksCommand.h:21
DtRwString myTrackAmount
Definition: persistentTracksCommand.h:144
virtual ~DtRemovePersistentTracksCommand() override
Destructor.
Definition: persistentTracksCommand.h:168
static std::vector< DtString > theTrackDepthsStringRep
Definition: persistentTracksCommand.h:76
#define DT_DLL_vrfplan
This file is used to determine how to build.
Definition: vrfplanDefines.h:28
static std::vector< DtString > theTrackTypesStringRep
Static Vectors.
Definition: persistentTracksCommand.h:75
DtRemovePersistentTracksCommand(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=NULL)
Usual constructor.
Definition: persistentTracksCommand.h:158
class DtRwVectorList:
Definition: rwVectorList.h:22
DtRemovePersistentTracksCommand()
Default constructor.
Definition: persistentTracksCommand.h:155
virtual int netRepSize() const override
Returns the size in bytes of the network representation of the class. This is the size in bytes of th...

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)