![]() |
VR-Forces 5.0.1 Developer's Guide
|
ReaderWriter object that maintains a list of reader-writer variable bindings. It keeps a list of names and reader-writer types that are associated with the name. This object differs from most other RW objects in that it writes out the RW type string for the object along with its name and type, and dynamically types the objects being read in based on the type string in the file. It uses the static DtReaderWriter::factory to do this.

Public Member Functions | |
| DtRwVariableBindings (const DtString &name, DtReaderWriterRegistry *parentRegistry=0) | |
| DtRwVariableBindings (const DtString &name, const DtRwVariableBindings &orig, DtReaderWriterRegistry *parentRegistry=0, bool copyVariables=true) | |
| DtRwVariableBindings (const DtRwVariableBindings &orig, DtReaderWriterRegistry *parentRegistry=0, bool copyVariables=true) | |
| DtRwVariableBindings & | operator= (const DtRwVariableBindings &orig) |
| virtual | ~DtRwVariableBindings () |
| virtual void | getSelf (DtlObjPtr args, const std::vector< DtFilename > &searchPaths=std::vector< DtFilename >(), const DtVariableBindingsList &variableBindings=nullVariableReference()) |
| virtual void | writeSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename()) |
| template<typename RW_Type > | |
| const RW_Type * | findAndCastVariableBinding (const DtString &variableName) const |
| virtual DtReaderWriter * | addVariableBinding (const DtSymbolString &name, const char *type) |
| virtual void | addVariable (DtReaderWriter *) |
| virtual void | removeVariable (DtReaderWriter *) |
| virtual void | removeVariable (const DtReaderWriter *) |
| virtual void | clearVariables () |
| virtual const char * | readerWriterType () const |
| virtual int | getSize () const |
| virtual char * | encode (char *) const |
| virtual const char * | decode (const char *) |
| bool | operator== (const DtRwVariableBindings &) const |
| bool | operator!= (const DtRwVariableBindings &) const |
| virtual DtString | prettyPrint () const |
| virtual void | setVariableSubstitutions (const std::map< DtString, DtString > &) |
| virtual const std::map < DtString, DtString > & | variableSubstitutions () const |
| virtual void | merge (const DtRwVariableBindings &) |
| virtual const DtReaderWriter * | findVariableBinding (const DtString &rwTypeString, const DtString &variableName, const std::map< DtString, DtString > &variableSubstitutions=std::map< DtString, DtString >()) const |
| virtual DtReaderWriter * | findVariableBinding (const DtString &rwTypeString, const DtString &variableName, const std::map< DtString, DtString > &variableSubstitutions=std::map< DtString, DtString >()) |
| virtual const DtReaderWriter * | findVariableBinding (const DtString &variableName, const std::map< DtString, DtString > &variableSubstitutions=std::map< DtString, DtString >()) const |
| virtual DtReaderWriter * | findVariableBinding (const DtString &variableName, const std::map< DtString, DtString > &variableSubstitutions=std::map< DtString, DtString >()) |
Public Member Functions inherited from DtReaderWriter | |
| DtReaderWriter () | |
| DtReaderWriter (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false) | |
| DtReaderWriter (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false) | |
| DtReaderWriter (const DtString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL) | |
| DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL) | |
| DtReaderWriter (const DtReaderWriter &, DtReaderWriterRegistry *parentRegistry=NULL) | |
| const DtReaderWriter & | operator= (const DtReaderWriter &orig) |
| bool | operator== (const DtReaderWriter &) const |
| bool | operator!= (const DtReaderWriter &rhs) |
| virtual | ~DtReaderWriter () |
| virtual void | putSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename()) |
| virtual void | postPutSelf () |
| virtual void | prePutSelf () |
| virtual void | postGetSelf () |
| virtual void | preGetSelf () |
| virtual DtSymbolString | name () const |
| virtual void | addAlias (const DtSymbolString &alias) |
| virtual void | addAlias (const DtString &alias) |
| virtual bool | hasAlias (const DtSymbolString &alias) |
| virtual const aliasContainer & | aliases () const |
| virtual void | setReadonly (bool flag) |
| bool | isReadonly () const |
| virtual void | reset () |
| virtual int | alignment () const |
| virtual bool | variableIsBound () const |
| virtual void | unbindVariable () |
| virtual void | setName (const DtString &) |
| virtual const char * | xmlType () const |
| std::string | debugText () const |
| virtual void | bindVariables (DtVariableBindingsList variableBindings) |
| virtual std::list < DtVariableNameType > | unboundVariables () const |
| bool | invalid () const |
| virtual bool | hasChild (const DtReaderWriter *p) const |
| virtual bool | hasVariableReference () const |
| virtual void | bindLocalVariables (const DtVariableBindingsList &variableBindings) |
| virtual void | recordUpdateTime () const |
| virtual bool | wasUpdatedSince (DtTime t) const |
| virtual bool | changedSinceLastChecked () |
| virtual bool | peekChangedSinceLastChecked () const |
| virtual void | putData (std::string &fp, int indentLevel=0) |
| virtual DtlObjPtr | getData (DtlObjPtr args, const SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) |
| virtual void | setValueSpecified (bool specified, bool recurse=false) |
| virtual bool | valueSpecified () const |
| virtual bool | isVariableReference () const |
| virtual void | setIsVariableReference (bool value) |
| virtual void | clearAllVariableReferenceFlags () |
| virtual DtSymbolString | variableName () const |
| virtual void | setVariableName (const DtSymbolString variableName) |
| virtual const DtReaderWriter * | defaultRWValue () const |
| virtual DtReaderWriter * | defaultRWValue () |
| virtual void | setDefaultRWValue (DtReaderWriter *) |
| virtual bool | checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference()) |
| const DtReaderWriterRegistry & | registry () const |
| DtReaderWriterRegistry & | registry () |
| virtual DtPropertyInterface * | property () |
| virtual const DtPropertyInterface * | property () const |
| virtual DtString | toXml () const |
| virtual DtRwVariableBindings * | generateVariableBindings () const |
| virtual bool | toXml (const DtFilename &) const |
| virtual bool | fromXml (const DtString &) |
| virtual bool | fromXmlFile (const DtFilename &) |
| virtual void | putSelf (DtEnvironmentSP, DtEnvValueSP parent) const |
| virtual void | putData (DtEnvironmentSP, DtEnvValueSP value) const |
| virtual void | putVariableReference (DtEnvironmentSP, DtEnvValueSP value) const |
| virtual void | getSelf (const DtEnvironmentSP, const DtEnvValueSP root, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList()) |
| virtual void | getData (const DtEnvironmentSP, const DtEnvValueSP, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList()) |
| virtual void | unrecognizedItem (const DtEnvironmentSP env, const DtEnvValueSP root, const SearchPaths &searchPaths, const DtVariableBindingsList &varBindings) |
| virtual void | getVariableReference (DtEnvironmentSP, DtEnvValueSP value) |
Static Public Member Functions | |
| static DtRwVariableBindings * | createBinding (const std::list< DtReaderWriter::DtVariableNameType > &) |
Static Public Member Functions inherited from DtReaderWriter | |
| static void | putIndent (std::string &fp, int indentLevel) |
| static const DtVariableBindingsList & | nullVariableReference () |
| static void | setPostGetSelfCallback (DtGetSelfCallbackFcn fcn, void *usrData) |
| static void | setPrePutSelfCallback (DtPutSelfCallbackFcn fcn, void *usrData) |
| static void | setPutIndent (bool) |
| static bool | putIndent () |
| static const char * | theXmlType () |
| static const DtFilename & | appPath () |
| static void | setFactoryCreatorFunction (DtReaderWriterFactoryCreatorFcn fcn) |
| static void | createReaderWriterFactory () |
| static void | cleanupFactory () |
| static DtReaderWriterFactory * | factory () |
| static void | setOutputStream (DtOutputStream *stream) |
| static DtOutputStream & | outputStream () |
| static DtReaderWriter * | createFromXmlFile (const DtFilename &, bool createAsProperty=false) |
| static DtReaderWriter * | createFromXml (const DtString &, bool createAsProperty=false) |
| static DtReaderWriter * | createFromEnvironment (DtEnvironmentSP, bool createAsProperty=false) |
| static DtString | getAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root) |
Protected Member Functions | |
| virtual const DtReaderWriter * | internalFindVariableBinding (const DtString &rwTypeString, const DtString &variableName, const std::map< DtString, DtString > &variableSubstitutions=std::map< DtString, DtString >()) const |
| virtual void | copyVariables (const DtRwVariableBindings &other) |
| virtual bool | keywordMatches (const DtSymbolString &lhs, const DtString &rhs, const std::map< DtString, DtString > &variableSubstitutions) const |
Protected Member Functions inherited from DtReaderWriter | |
| virtual void | bindToRwAsVariable (const DtReaderWriter *rw) |
Protected Attributes | |
| std::map< DtString, DtString > | myVariableSubstitutions |
Protected Attributes inherited from DtReaderWriter | |
| const DtSymbolString | myName |
| DtReaderWriterRegistry | myRegistry |
| DtReaderWriterRegistry * | myParentRegistry |
| bool | myValueSpecified |
| bool | myReadOnlyFlag |
| bool | myIsVariableReference |
| DtSymbolString | myVariableName |
| bool | myVariableIsBound |
| DtReaderWriter * | myDefaultValue |
| aliasContainer | myAliases |
| bool | myInvalid |
| bool | myChangedFlag |
Private Member Functions | |
| DtRwVariableBindings () | |
Additional Inherited Members | |
Public Types inherited from DtReaderWriter | |
| typedef std::vector < DtSymbolString > | aliasContainer |
| typedef std::vector < DtSymbolString >::iterator | aliasIter |
| typedef std::vector < DtSymbolString > ::const_iterator | aliasConstIter |
| typedef std::vector< DtFilename > | SearchPaths |
| typedef std::pair < DtSymbolString, DtString > | DtVariableNameType |
| typedef DtReaderWriterFactory *(* | DtReaderWriterFactoryCreatorFcn )() |
Static Protected Attributes inherited from DtReaderWriter | |
| static DtString | theUnspecifiedValue |
| static DtGetSelfCallbackInfo | thePostGetSelfCallback |
| static DtPutSelfCallbackInfo | thePrePutSelfCallback |
| static const DtVariableBindingsList | theEmptyVariableBindingsList |
| static bool | theCreatorFcnSet |
| static DtReaderWriterFactory * | theFactory |
| static DtReaderWriterFactoryCreatorFcn | theFactoryCreatorFcn |
| static bool | thePutIndent |
| static DtOutputStream * | theOutputStream |
|
private |
Not implemented.
| DtRwVariableBindings::DtRwVariableBindings | ( | const DtString & | name, |
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
| DtRwVariableBindings::DtRwVariableBindings | ( | const DtString & | name, |
| const DtRwVariableBindings & | orig, | ||
| DtReaderWriterRegistry * | parentRegistry = 0, |
||
| bool | copyVariables = true |
||
| ) |
| DtRwVariableBindings::DtRwVariableBindings | ( | const DtRwVariableBindings & | orig, |
| DtReaderWriterRegistry * | parentRegistry = 0, |
||
| bool | copyVariables = true |
||
| ) |
|
virtual |
| DtRwVariableBindings& DtRwVariableBindings::operator= | ( | const DtRwVariableBindings & | orig | ) |
|
virtual |
Reads in items, using the factory to read the correct types.
Reimplemented from DtReaderWriter.
Reimplemented in DtRwProperties, and DtRwPropertiesList.
|
virtual |
Writes out registry data, but includes the type strings when writing.
Reimplemented from DtReaderWriter.
Reimplemented in DtRwProperties, and DtRwPropertiesList.
|
virtual |
Looks for the specified name/type combination in the registry, and returns a pointer to that RW object if it is found. The variable substitutions is a map of items that can be used in trying to see if a variable named one thing should also be referenced as something else. If set this will replace the existing variable substitution map that might be part of this class.
|
virtual |
Looks for the specified name/type combination in the registry, and returns a pointer to that RW object if it is found. The variable substitutions is a map of items that can be used in trying to see if a variable named one thing should also be referenced as something else. If set this will replace the existing variable substitution map that might be part of this class.
|
virtual |
Finds the variable with the given name regardless of type.
|
virtual |
Finds the variable with the given name regardless of type.
|
inline |
|
static |
Creates a new instance of this class and creates all elements found in the list and adds it to this variables registry. Calls addVariableBinding() to add new variable.
|
virtual |
Adds new variable binding to registry. The new DtReaderWriter item is created using the DtReaderWriter::factory() by passing the type parameter. The item is added to this variable binding structure, and returned.
|
virtual |
Adds a newly created DtReaderWriter variable to the registry. This class will then take ownership of the variable.
|
virtual |
Reimplemented in DtRwProperties.
|
virtual |
Reimplemented in DtRwProperties.
|
virtual |
Removes and deletes all variable items.
Reimplemented in DtRwProperties.
|
virtual |
Used to supply a string type that this reader writer type is. This can be used in place of dynamic-casting. Also used by the opd editor to determine which type of control to create.
Reimplemented from DtReaderWriter.
Reimplemented in DtRwProperties, DtRwPropertiesMap, DtRwPropertiesStructure, DtRwPropertiesList, and DtRwPropertiesFixedArray.
|
virtual |
Returns the size of this item, in bytes, iterating over all types.
Encodes the variable bindings into the supplied buffer.
Reimplemented in DtRwProperties, DtRwPropertiesList, and DtRwPropertiesFixedArray.
Decodes the variable bindings from the specified buffer.
Reimplemented in DtRwProperties, DtRwPropertiesList, and DtRwPropertiesFixedArray.
| bool DtRwVariableBindings::operator== | ( | const DtRwVariableBindings & | ) | const |
| bool DtRwVariableBindings::operator!= | ( | const DtRwVariableBindings & | ) | const |
|
virtual |
Routine to return a human readable form of the reader/writer variable. Not all reader/writer classes implement this feature. Default is to return an empty string.
Reimplemented from DtReaderWriter.
|
virtual |
|
virtual |
|
virtual |
Will take the contents of the supplied variable bindings and merge in both the variables (ignoring ones that already exist) and the variable substitutions.
|
protectedvirtual |
Actual find method such that the const and non-const versions can share the same code.
|
protectedvirtual |
Copies all variable items from another bindings list and adds them to the local one.
Reimplemented in DtRwProperties, and DtRwPropertiesStructure.
|
protectedvirtual |
Check to see if there are any variable substitutions such that a variable named something has a map to another name and can match the right hand side.