64 myStr(rhs.myStr), myInt(rhs.myInt), myDbl(rhs.myDbl), myType(rhs.myType) {};
66 Key(
const DtString& str) : myStr(str), myInt(0), myDbl(0), myType(StrType) {};
68 Key(
int i) : myStr(), myInt(i), myDbl(0), myType(IntType) {};
70 Key(
double d) : myStr(), myInt(0), myDbl(d), myType(DoubleType) {};
77 return myInt == rhs.
myInt;
80 return myDbl == rhs.
myDbl;
84 return myStr == rhs.
myStr;
94 return myInt < rhs.
myInt;
97 return myDbl < rhs.
myDbl;
101 return myStr < rhs.
myStr;
180 template <
typename ValueType>
181 boost::optional<ValueType> findItemValue(
const DtString& key)
const;
184 template <
typename ValueType>
185 boost::optional<ValueType> findItemValue(
int key)
const;
188 template <
typename ValueType>
189 boost::optional<ValueType> findItemValue(
double key)
const;
192 template <
typename ValueType>
193 boost::optional<ValueType> findItemValue(
const Key& key)
const;
241 virtual bool erase(
int key);
242 virtual bool erase(
double key);
280 virtual const char *
xmlType()
const override {
288 virtual void setKeyType(
const DtString&);
294 virtual bool keyIsInt()
const;
295 virtual bool keyIsReal()
const;
296 virtual bool keyIsString()
const;
304 virtual std::set<Key> allKeys()
const;
308 bool strict =
true)
const override;
318 virtual bool convertKeyToString(
int key,
DtString& str)
const;
321 virtual bool convertKeyToString(
double key,
DtString& str)
const;
324 virtual bool convertStringToKey(
const DtString& str,
int& key)
const;
327 virtual bool convertStringToKey(
const DtString& str,
double& key)
const;
345 const char *
buf)
override;
359 int indentLevel)
override;
361 int indentLevel)
override;
379 template <
typename ValueType>
384 return findPropertyValue<ValueType>(key);
387 return boost::optional<ValueType>();
390 template <
typename ValueType>
396 return findPropertyValue<ValueType>(keyStr);
399 return boost::optional<ValueType>();
402 template <
typename ValueType>
408 return findPropertyValue<ValueType>(keyStr);
411 return boost::optional<ValueType>();
414 template <
typename ValueType>
415 boost::optional<ValueType>
418 return findPropertyValue<ValueType>(key.
string());
virtual void putData(DtEnvironmentSP, DtEnvValueSP value) const override
Override to add attributes of actual data.
Definition: rwPropertiesMap.h:130
DtString string() const
Definition: rwPropertiesMap.h:106
#define DT_DLL_readerWriter
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: readerWriterDefines.h:34
virtual DtlObjPtr variablesStart(DtlObjPtr args) const
virtual void createListEntry(DtPropertyInterface *iFace, DtlObjPtr variableItem, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
double myDbl
Definition: rwPropertiesMap.h:125
Wrapper for the map key. Makes it easier to write code that doesn't necessarily need to worry about t...
Definition: rwPropertiesMap.h:61
virtual char * encode(char *) const override
Encodes the property into the supplied buffer. Does not align the property. Buffer must already be al...
DtPropertyInterface * myScratchItem
Definition: rwPropertiesMap.h:376
virtual const char * decode(const char *) override
Decodes the property from the specified buffer. Assumes buffer is the start of the property and prece...
virtual bool convertKeyToString(int key, DtString &str) const
Convert the given int key to a DtString. If not possible, returns false.
voidpf void uLong size
Definition: ioapi.h:39
virtual DtlObjPtr getData(DtlObjPtr variableList, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override
Override to allow a variable to be assigned to a property of derived type.
virtual void preWriteItem(std::string &fp, DtReaderWriter *rw, int indentLevel)
Definition: readerWriter.h:85
virtual int hlaAlignment() const override
The required byte alignment of this property when encoding to HLA.
virtual void postWriteItem(std::string &fp, DtReaderWriter *rw, int indentLevel)
Key(const Key &rhs)
Definition: rwPropertiesMap.h:63
Definition: readerWriterRegistry.h:39
KeyType
Definition: rwPropertiesMap.h:127
voidpf void * buf
Definition: ioapi.h:39
bool operator<(const Key &rhs) const
Definition: rwPropertiesMap.h:89
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
virtual void writePrototype(const DtReaderWriter *, std::string &fp, int indentLevel, bool writeHeader=true) const
virtual bool keyIsString() const
Returns the type of key.
virtual const char * xmlType() const override
Definition: rwPropertiesMap.h:280
boost::optional< ValueType > findItemValue(const DtString &key) const
Finds the value of the item with the specified key. Will fail if the type of the key does not match t...
Definition: rwPropertiesMap.h:380
virtual DtPropertyInterface * createPrototype(DtlObjPtr)
DtPropertyInterface * myKeyType
Definition: rwPropertiesMap.h:374
virtual bool isSimilarProperty(const DtPropertyInterface *rhs, bool strict=true) const override
Returns true prototype is the same.
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
bool operator==(const Key &rhs) const
Definition: rwPropertiesMap.h:72
int getSize() const
Returns the network size of this item in bytes. This does not include any upfront padding for alignme...
Acts as a map for properties. A map is a definition that has a key and a prototype, with values being the key and prototype pair. The key can only be a string (DtRwStringType), int (DtRwIntType, DtRwInt8Type, DtRwInt16Type, DtRwInt32Type), or real (DtRwRealType, DtRwReal32Type, DtRwReal64Type).
Definition: rwPropertiesMap.h:41
Key(double d)
Definition: rwPropertiesMap.h:70
virtual int requiredPadding(const char *buf, const DtPropertyInterface *field) const
The number of padding bytes required before writing the given field to the buffer for HLA encoding...
KeyType myType
Definition: rwPropertiesMap.h:133
int myInt
Definition: rwPropertiesMap.h:124
bool operator==(const DtRwPropertiesList &) const
DtString myStr
Definition: rwPropertiesMap.h:123
DtRwPropertiesList & operator=(const DtRwPropertiesList &)
virtual void erase(DtPropertyInterface *item)
Erases the specified item.
Acts as a DtRwList for properties. Only real difference between this class and a DtRwProperties class...
Definition: rwPropertiesList.h:38
Key(int i)
Definition: rwPropertiesMap.h:68
DT_DLL_readerWriter std::shared_ptr< DtEnvironment > DtEnvironmentSP
Definition: readerWriter.h:30
Key(const DtString &str)
Definition: rwPropertiesMap.h:66
Definition: rwPropertiesMap.h:129
virtual const char * readerWriterType() const override
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-ca...
virtual DtPropertyInterface * addItem()
Adds a new item to the end of the list of the same type as myPrototype. Returns this item so that it ...
static const char * theXmlType()
The type that is used when archiving to an XML stream.