VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rwTemplatedList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "readerWriter/rwList.h"
12 #include "vrfutil/iteratorBase.h"
14 
15 #include "readerWriter/rwString.h"
16 #include "readerWriter/rwInt.h"
17 #include "readerWriter/rwReal.h"
18 #include "vrfutil/rwUUID.h"
19 
25 template <typename T, bool T_autoDelete>
27 {
28 public:
31 
34 
36  DtRwTemplatedListPtr(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL);
37  DtRwTemplatedListPtr(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL);
38 
42  DtReaderWriterRegistry* parentRegistry = NULL);
43 
45  DtReaderWriterRegistry* parentRegistry = NULL);
46 
49  DtReaderWriterRegistry* parentRegistry = NULL);
50 
52 
53  virtual ~DtRwTemplatedListPtr();
54 
55  DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
56  const DtVariableBindingsList& variableBindings);
57 
60  virtual DtListItem* add(T* data) {return DtRwList::add(data);};
61 
64  void removeAll();
65  void* remove(DtListItem* item);
66  void* remove(T* item);
67 
69  virtual std::set<DtString> supportedXmlTypes() const;
70 
72  void removeAndDeleteAll();
73 
75  bool operator==(const DtRwTemplatedListPtr&) const;
76  bool operator!=(const DtRwTemplatedListPtr&) const;
77 
78  static const char* theXmlType()
79  {
80  static DtString xmlType(DtString(T::theXmlType()) + "s");
81  return xmlType.c_str();
82  }
83 
84  virtual const char* xmlType() const
85  {
86  return theXmlType();
87  }
88 
89  //Populates list by looking add the templated list type
90  virtual void populateList(
91  boost::function<void (DtReaderWriter*)> addFunction,
92  DtEnvironmentSP env, DtEnvValueSP node,
93  const DtReaderWriter::SearchPaths& searchPaths, const DtVariableBindingsList& bindings);
94 
96  DtListItem* find( boost::function< bool (const T&)> predFcn) const;
97 
98  virtual DtString prettyPrint() const;
99 
100 public:
101 
102  const char* readerWriterType() const;
103 
104  static const char* ListReaderWriterType();
105 
106  void copyList(const DtRwTemplatedListPtr& orig);
107 
108 protected:
110 };
111 
112 namespace DtBufferSerialize
113 {
116  template <typename T, bool T_autoDelete>
118 
122  template <typename T, bool T_autoDelete>
123  char *encode(const DtRwTemplatedListPtr<T, T_autoDelete>& val, char *buffer);
124 
129  template <typename T, bool T_autoDelete>
130  const char *decode(DtRwTemplatedListPtr<T, T_autoDelete>& val, const char *buffer) ;
131 };
132 
134 {
135 public:
138 
140  DtRwTemplatedStringList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL)
141  : DtRwTemplatedListPtr<DtRwString, true>(name, parentRegistry) {};
142  DtRwTemplatedStringList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL)
143  : DtRwTemplatedListPtr<DtRwString, true>(name, parentRegistry) {};
144 
146  DtReaderWriterRegistry* parentRegistry = NULL)
147  : DtRwTemplatedListPtr<DtRwString, true>(name, orig, parentRegistry) {};
148 
150  DtReaderWriterRegistry* parentRegistry = NULL)
151  : DtRwTemplatedListPtr<DtRwString, true>(name, orig, parentRegistry) {};
152 
154  DtReaderWriterRegistry* parentRegistry = NULL)
155  : DtRwTemplatedListPtr<DtRwString, true>(orig, parentRegistry) {};
156 };
157 
159 {
160 public:
163 
165  DtRwTemplatedUUIDList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL)
166  : DtRwTemplatedListPtr<DtRwUUID, true>(name, parentRegistry) {};
167  DtRwTemplatedUUIDList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL)
168  : DtRwTemplatedListPtr<DtRwUUID, true>(name, parentRegistry) {};
169 
171  DtReaderWriterRegistry* parentRegistry = NULL)
172  : DtRwTemplatedListPtr<DtRwUUID, true>(name, orig, parentRegistry) {};
173 
175  DtReaderWriterRegistry* parentRegistry = NULL)
176  : DtRwTemplatedListPtr<DtRwUUID, true>(name, orig, parentRegistry) {};
177 
179  DtReaderWriterRegistry* parentRegistry = NULL)
180  : DtRwTemplatedListPtr<DtRwUUID, true>(orig, parentRegistry) {};
181 };
182 
184 {
185 public:
188 
190  DtRwTemplatedIntList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL)
191  : DtRwTemplatedListPtr<DtRwInt, true>(name, parentRegistry) {};
192 
193  DtRwTemplatedIntList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL)
194  : DtRwTemplatedListPtr<DtRwInt, true>(name, parentRegistry) {};
195 
197  DtReaderWriterRegistry* parentRegistry = NULL)
198  : DtRwTemplatedListPtr<DtRwInt, true>(name, orig, parentRegistry) {};
199 
201  DtReaderWriterRegistry* parentRegistry = NULL)
202  : DtRwTemplatedListPtr<DtRwInt, true>(name, orig, parentRegistry) {};
203 
205  DtReaderWriterRegistry* parentRegistry = NULL)
206  : DtRwTemplatedListPtr<DtRwInt, true>(orig, parentRegistry) {};
207 };
208 
210 {
211 public:
214 
216  DtRwTemplatedRealList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL)
217  : DtRwTemplatedListPtr<DtRwReal, true>(name, parentRegistry) {};
218 
219  DtRwTemplatedRealList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL)
220  : DtRwTemplatedListPtr<DtRwReal, true>(name, parentRegistry) {};
221 
223  DtReaderWriterRegistry* parentRegistry = NULL)
224  : DtRwTemplatedListPtr<DtRwReal, true>(name, orig, parentRegistry) {};
225 
227  DtReaderWriterRegistry* parentRegistry = NULL)
228  : DtRwTemplatedListPtr<DtRwReal, true>(name, orig, parentRegistry) {};
229 
231  DtReaderWriterRegistry* parentRegistry = NULL)
232  : DtRwTemplatedListPtr<DtRwReal, true>(orig, parentRegistry) {};
233 };
234 
235 #include "vrfutil/rwTemplatedList.inl"
Definition: rwTemplatedList.h:158
DtRwTemplatedRealList(const DtString &name, const DtRwTemplatedRealList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:222
DtRwTemplatedUUIDList(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:167
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
DtRwTemplatedUUIDList(const DtRwTemplatedUUIDList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:178
bool operator==(const DtRwTemplatedListPtr &) const
Equivalence operators.
virtual void populateList(boost::function< void(DtReaderWriter *)> addFunction, DtEnvironmentSP env, DtEnvValueSP node, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &bindings)
Definition: rwTemplatedList.h:183
Definition: symbolString.h:20
DtRwTemplatedStringList(const DtSymbolString &name, const DtRwTemplatedStringList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:149
A Readable, Writable version of DtList.
Definition: rwList.h:26
DtString myXmlType
Definition: rwTemplatedList.h:109
bool operator!=(const DtRwTemplatedListPtr &) const
DT_DLL_readerWriter DtBoost::shared_ptr< DtEnvironment > DtEnvironmentSP
Definition: readerWriter.h:30
DtRwTemplatedStringList(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
real constructor
Definition: rwTemplatedList.h:140
DtRwTemplatedListPtr & operator=(const DtRwTemplatedListPtr &orig)
Definition: rwTemplatedList.h:209
DtRwTemplatedUUIDList(const DtString &name, const DtRwTemplatedUUIDList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:170
Definition: readerWriter.h:85
Description: Readable, Writable DtString Variable substitutions are done on this object when it is re...
Definition: rwString.h:20
void copyList(const DtRwTemplatedListPtr &orig)
DtRwTemplatedRealList(const DtRwTemplatedRealList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:230
static const char * theXmlType()
Definition: rwTemplatedList.h:78
Definition: readerWriterRegistry.h:39
DtRwTemplatedStringList(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:142
virtual DtString prettyPrint() const
Routine to return a human readable form of the reader/writer variable.
DtRwTemplatedRealList()
default constructor
Definition: rwTemplatedList.h:213
Description: Readable, Writable uuid string.
Definition: rwUUID.h:419
virtual const char * xmlType() const
Definition: rwTemplatedList.h:84
virtual DtListItem * add(T *data)
Define this function to hide the DtRwList version, and accept only the specific DtReaderWriter subcla...
Definition: rwTemplatedList.h:60
static const char * ListReaderWriterType()
DtIteratorBase< T > iterator
Definition: rwTemplatedList.h:29
DtRwTemplatedIntList(const DtRwTemplatedIntList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:204
Description: DtIteratorBase is the base class for iterators used to iterate over a DtList...
Definition: iteratorBase.h:32
DtRwTemplatedRealList(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
real constructor
Definition: rwTemplatedList.h:216
virtual std::set< DtString > supportedXmlTypes() const
Returns list of supported types. Default is the templated object xml type.
DtRwTemplatedIntList(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:193
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
This method must be overridden by a subclass.
DtRwTemplatedRealList(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:219
Description: Readable, Writable int.
Definition: rwInt.h:25
DtRwTemplatedStringList(const DtRwTemplatedStringList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:153
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
DtRwTemplatedUUIDList(const DtSymbolString &name, const DtRwTemplatedUUIDList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:174
virtual DtListItem * add(DtReaderWriter *data)
Add element to the end of the list.
DtRwTemplatedStringList()
default constructor
Definition: rwTemplatedList.h:137
virtual ~DtRwTemplatedListPtr()
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer.
const char * readerWriterType() const
Used to supply a string type that this reader writer type is.
void removeAll()
Removes all entries from the list.
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
DtIteratorBase< const T > const_iterator
Definition: rwTemplatedList.h:30
Definition: rwTemplatedList.h:133
A version of DtRwList that contains a homogeneous list of a templated RW type.
Definition: rwTemplatedList.h:26
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
DtRwTemplatedListPtr()
default constructor
DtRwTemplatedIntList()
default constructor
Definition: rwTemplatedList.h:187
DtRwTemplatedRealList(const DtSymbolString &name, const DtRwTemplatedRealList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:226
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...
DtRwTemplatedIntList(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
real constructor
Definition: rwTemplatedList.h:190
void removeAndDeleteAll()
Removes and deletes all entries in the list.
DtRwTemplatedIntList(const DtString &name, const DtRwTemplatedIntList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:196
DtListItem * find(boost::function< bool(const T &)> predFcn) const
Finds the first item in the list for which predFcn returns true.
DtRwTemplatedUUIDList()
default constructor
Definition: rwTemplatedList.h:162
virtual DtSymbolString name() const
Accessor for name of this readable/writable object.
DtRwTemplatedUUIDList(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
real constructor
Definition: rwTemplatedList.h:165
DtRwTemplatedIntList(const DtSymbolString &name, const DtRwTemplatedIntList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:200
DtRwTemplatedStringList(const DtString &name, const DtRwTemplatedStringList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Definition: rwTemplatedList.h:145

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)