VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtSimResource Class Reference

DtSimResource is a class which will define a SISO Enumeration to use as a resource and the quantity of that resource that it represents.

Inheritance diagram for DtSimResource:
Inheritance graph
[legend]

Classes

class  RwMunitionOrEntityType
 

Public Types

typedef void(* UpdateCallback )(DtSimResource *, void *)
 
- 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 )()
 

Public Member Functions

 DtSimResource ()
 
 DtSimResource (const DtString &resourceName, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtSimResource (const DtSymbolString &resourceName, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtSimResource (const DtSimResource &orig)
 
DtSimResourceoperator= (const DtSimResource &orig)
 
virtual ~DtSimResource () override
 
virtual const charreaderWriterType () const override
 
virtual const charxmlType () const override
 
bool operator!= (const DtSimResource &orig) const
 
bool operator== (const DtSimResource &orig) const
 
virtual void deplete (double d=1)
 
virtual bool matches (const std::vector< DtEntityType > &) const
 
virtual void setResourceType (const DtEntityType &)
 
const DtEntityType & resourceType () const
 
virtual void setCurrentAmount (double amount)
 
void setAmount (double a)
 
double currentAmount () const
 
double amount () const
 
virtual void setValueIsInteger (bool)
 
bool valueIsInteger () const
 
virtual void setFullAmount (double amount)
 
double fullAmount () const
 
virtual void setRestore (bool)
 
bool shouldRestore () const
 
virtual void restore ()
 
virtual int netRepSize () const
 
virtual const charsetFromNet (const char *contentBuffer)
 
virtual void addUpdateCallback (UpdateCallback fcn, void *usrData)
 
virtual void removeUpdateCallback (UpdateCallback fcn, void *usrData)
 
virtual void callUpdateCallbacks ()
 
virtual charsetToNet (char *contentBuffer) const
 
virtual double percentageFull () const
 
const DtRwRealcurrentAmountVariable () const
 
DtRwRealcurrentAmountVariable ()
 
const DtRwRealfullAmountVariable () const
 
DtRwRealfullAmountVariable ()
 
const DtRwBooleanrestoreVariable () const
 
DtRwBooleanrestoreVariable ()
 
int bin () const
 
virtual void setBin (int)
 
virtual void clearFullAmount ()
 
virtual void getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override
 
virtual DtString prettyPrint () const override
 
virtual void setDisplayName (const DtString &)
 
const DtStringdisplayName () const
 
- 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 DtReaderWriteroperator= (const DtReaderWriter &orig)
 
bool operator== (const DtReaderWriter &) const
 
bool operator!= (const DtReaderWriter &rhs) const
 
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 preGetSelf ()
 
virtual void writeSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 
virtual DtSymbolString name () const
 
virtual void addAlias (const DtSymbolString &alias)
 
virtual void addAlias (const DtString &alias)
 
virtual bool hasAlias (const DtSymbolString &alias)
 
virtual const aliasContaineraliases () 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 &)
 
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 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 DtReaderWriterdefaultRWValue () const
 
virtual DtReaderWriterdefaultRWValue ()
 
virtual void setDefaultRWValue (DtReaderWriter *)
 
virtual bool checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 
const DtReaderWriterRegistryregistry () const
 
DtReaderWriterRegistryregistry ()
 
virtual DtPropertyInterfaceproperty ()
 
virtual const DtPropertyInterfaceproperty () const
 
virtual DtString toXml () const
 
virtual DtRwVariableBindingsgenerateVariableBindings () 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 const chartheXmlType ()
 
- 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 chartheXmlType ()
 
static const DtFilename & appPath ()
 
static void setFactoryCreatorFunction (DtReaderWriterFactoryCreatorFcn fcn)
 
static void createReaderWriterFactory ()
 
static void cleanupFactory ()
 
static DtReaderWriterFactoryfactory ()
 
static void setOutputStream (DtOutputStream *stream)
 
static DtOutputStream & outputStream ()
 
static DtReaderWritercreateFromXmlFile (const DtFilename &, bool createAsProperty=false)
 
static DtReaderWritercreateFromXml (const DtString &, bool createAsProperty=false)
 
static DtReaderWritercreateFromEnvironment (DtEnvironmentSP, bool createAsProperty=false)
 
static DtString getAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root)
 

Protected Member Functions

virtual void postGetSelf () override
 
- Protected Member Functions inherited from DtReaderWriter
virtual void bindToRwAsVariable (const DtReaderWriter *rw)
 

Protected Attributes

RwMunitionOrEntityType myResource
 
DtRwReal myCurrentAmount
 
DtRwReal myFullAmount
 
DtRwBoolean myRestore
 
DtRwInt myBin
 
DtCallbackList< DtSimResource * > myUpdateCallbacks
 
int myValueIsInteger = false
 
DtString myDisplayName
 
- Protected Attributes inherited from DtReaderWriter
const DtSymbolString myName
 
DtReaderWriterRegistry myRegistry
 
DtReaderWriterRegistrymyParentRegistry
 
bool myValueSpecified
 
bool myReadOnlyFlag
 
bool myIsVariableReference
 
DtSymbolString myVariableName
 
bool myVariableIsBound
 
DtReaderWritermyDefaultValue
 
aliasContainer myAliases
 
bool myInvalid
 
bool myChangedFlag
 

Additional Inherited Members

- Static Protected Attributes inherited from DtReaderWriter
static DtString theUnspecifiedValue
 
static DtGetSelfCallbackInfo thePostGetSelfCallback
 
static DtPutSelfCallbackInfo thePrePutSelfCallback
 
static const DtVariableBindingsList theEmptyVariableBindingsList
 
static bool theCreatorFcnSet
 
static DtReaderWriterFactorytheFactory
 
static
DtReaderWriterFactoryCreatorFcn 
theFactoryCreatorFcn
 
static bool thePutIndent
 
static DtOutputStream * theOutputStream
 

Member Typedef Documentation

typedef void(* DtSimResource::UpdateCallback)(DtSimResource *, void *)

Constructor & Destructor Documentation

DtSimResource::DtSimResource ( )

default constructor

DtSimResource::DtSimResource ( const DtString resourceName,
DtReaderWriterRegistry parentRegistry = NULL 
)

real constructor

The resource name is the name that will be used to look up the resource in the resource manager.

DtSimResource::DtSimResource ( const DtSymbolString resourceName,
DtReaderWriterRegistry parentRegistry = NULL 
)
DtSimResource::DtSimResource ( const DtSimResource orig)

copy constructor

virtual DtSimResource::~DtSimResource ( )
overridevirtual

destructor

Member Function Documentation

DtSimResource& DtSimResource::operator= ( const DtSimResource orig)

assignment operator

virtual const char* DtSimResource::readerWriterType ( ) const
overridevirtual

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.

static const char* DtSimResource::theXmlType ( )
static

The type that is used when archiving to an XML stream.

virtual const char* DtSimResource::xmlType ( ) const
inlineoverridevirtual

Reimplemented from DtReaderWriter.

References DtReaderWriter::theXmlType().

bool DtSimResource::operator!= ( const DtSimResource orig) const
inline

Expects subclasses to implement isEqual method. Default returns false.

bool DtSimResource::operator== ( const DtSimResource orig) const
virtual void DtSimResource::deplete ( double  d = 1)
virtual

Removes from current amount.

virtual bool DtSimResource::matches ( const std::vector< DtEntityType > &  ) const
virtual

Returns true if this is a munition resource (based on resource type)

virtual void DtSimResource::setResourceType ( const DtEntityType &  )
virtual
const DtEntityType& DtSimResource::resourceType ( ) const
inline
virtual void DtSimResource::setCurrentAmount ( double  amount)
virtual
void DtSimResource::setAmount ( double  a)
inline
double DtSimResource::currentAmount ( ) const
double DtSimResource::amount ( ) const
inline
virtual void DtSimResource::setValueIsInteger ( bool  )
virtual
bool DtSimResource::valueIsInteger ( ) const
inline
virtual void DtSimResource::setFullAmount ( double  amount)
virtual
double DtSimResource::fullAmount ( ) const
virtual void DtSimResource::setRestore ( bool  )
virtual
bool DtSimResource::shouldRestore ( ) const
inline
virtual void DtSimResource::restore ( )
virtual
virtual int DtSimResource::netRepSize ( ) const
virtual
virtual const char* DtSimResource::setFromNet ( const char contentBuffer)
virtual

Fills in the task from the network buffer. Content size is not used.

virtual void DtSimResource::addUpdateCallback ( UpdateCallback  fcn,
void *  usrData 
)
virtual

Add a callback to be called when the value of this resource changes.

virtual void DtSimResource::removeUpdateCallback ( UpdateCallback  fcn,
void *  usrData 
)
virtual

Remove a callback to be called when the value of this resource changes.

virtual void DtSimResource::callUpdateCallbacks ( )
virtual

Calls all of the update callbacks. Must be called by subclasses when values change.

virtual char* DtSimResource::setToNet ( char contentBuffer) const
virtual

Fills in the network buffer with the task contents. Buffer must be allocated by the caller, with size netRepSize.

virtual double DtSimResource::percentageFull ( ) const
virtual

Current amount / full amount.

const DtRwReal& DtSimResource::currentAmountVariable ( ) const
inline
DtRwReal& DtSimResource::currentAmountVariable ( )
inline
const DtRwReal& DtSimResource::fullAmountVariable ( ) const
inline
DtRwReal& DtSimResource::fullAmountVariable ( )
inline
const DtRwBoolean& DtSimResource::restoreVariable ( ) const
inline
DtRwBoolean& DtSimResource::restoreVariable ( )
inline
int DtSimResource::bin ( ) const
inline
virtual void DtSimResource::setBin ( int  )
virtual
virtual void DtSimResource::clearFullAmount ( )
virtual
virtual void DtSimResource::getSelf ( DtlObjPtr  args,
const DtReaderWriter::SearchPaths searchPaths,
const DtVariableBindingsList variableBindings 
)
overridevirtual

Top level to read itself from an input stream. searchPath is passed down to all DtReaderWriter members in its DtReaderWriterRegistry (collection of child DtReaderWriter nodes). If a given member in the registry is of type DtReaderWriterFile, and the searchPath is specified with a non-NULL string, then file to be read in is searched for in the given path.

Reimplemented from DtReaderWriter.

virtual DtString DtSimResource::prettyPrint ( ) const
overridevirtual

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 void DtSimResource::setDisplayName ( const DtString )
virtual

This is only used locally. it is not sent over the network nor saved anywhere. If creating this resource in code in the front-end and you want to display this name rather than a name based on the entity type, set this here. Set to the empty string to go back to the dictionary name.

const DtString& DtSimResource::displayName ( ) const
inline
virtual void DtSimResource::postGetSelf ( )
overrideprotectedvirtual

Called after either version of getSelf (mtl or environment). Default is no-op.

Reimplemented from DtReaderWriter.

Member Data Documentation

RwMunitionOrEntityType DtSimResource::myResource
protected
DtRwReal DtSimResource::myCurrentAmount
protected
DtRwReal DtSimResource::myFullAmount
protected
DtRwBoolean DtSimResource::myRestore
protected
DtRwInt DtSimResource::myBin
protected
DtCallbackList<DtSimResource*> DtSimResource::myUpdateCallbacks
protected
int DtSimResource::myValueIsInteger = false
protected
DtString DtSimResource::myDisplayName
protected

The documentation for this class was generated from the following file:

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)