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

The DtVrfNameGenerator class will generate a unique name by object type.

Classes

struct  NameGenerationInfo
 

Public Member Functions

 DtVrfNameGenerator ()
 
virtual ~DtVrfNameGenerator ()
 
virtual bool init (DtSimulationServices *)
 
virtual void clear ()
 
virtual DtString nextName (const DtObjectType &)
 
virtual DtString nextNameWithPrefix (const DtObjectType &objectType, const DtString &potentialPrefix)
 
virtual unsigned int maxNameLengthForType (const DtObjectType &objectType) const
 
virtual DtString generateUniqueName (int maxLength, const DtString &root="Object")
 
virtual DtString nextNameWithPrefix (int maxLength, const DtString &potentialPrefix)
 
virtual DtString nextUnorganizedName ()
 
virtual bool parseName (const DtString &name, DtString &shortName, int &number) const
 

Protected Types

typedef std::pair< int, intRange
 
typedef std::vector< RangeRanges
 
typedef std::map< DtString,
NameGenerationInfo
NameGenerationMap
 

Protected Member Functions

virtual void processSimObjectDeleted (DtSimObjectReference)
 
virtual void processSimObjectAdded (DtSimObjectReference)
 
virtual void processSimObjectRenamed (const DtSimObject *, const DtString &oldText, const DtString &newText)
 
virtual DtString createPullFrom (const DtString &current, int low, int high) const
 
virtual void giveBack (const DtString &shortName, int number)
 
virtual void take (const DtString &shortName, int number, bool affectDuplicateCount=false)
 
virtual int getNextNumber (const DtString &)
 
virtual void takeFromRange (Ranges &, int number) const
 

Protected Attributes

DtSimulationServicesmySimulationServices
 
tbb::recursive_mutex myMutex
 
tbb::atomic< intmyNextUnorganizedName
 
NameGenerationMap myNameGenerationMap
 
boost::signals2::scoped_connection mySimObjectAddedConnection
 
boost::signals2::scoped_connection mySimObjectDeletedConnection
 
boost::signals2::scoped_connection mySimObjectRenamedConnection
 

Member Typedef Documentation

typedef std::pair<int, int> DtVrfNameGenerator::Range
protected
typedef std::vector<Range> DtVrfNameGenerator::Ranges
protected

Constructor & Destructor Documentation

DtVrfNameGenerator::DtVrfNameGenerator ( )

constructor

virtual DtVrfNameGenerator::~DtVrfNameGenerator ( )
virtual

destructor

Member Function Documentation

virtual bool DtVrfNameGenerator::init ( DtSimulationServices )
virtual
virtual void DtVrfNameGenerator::clear ( )
virtual
virtual DtString DtVrfNameGenerator::nextName ( const DtObjectType )
virtual

Returns the next available name given the object type.

virtual DtString DtVrfNameGenerator::nextNameWithPrefix ( const DtObjectType objectType,
const DtString potentialPrefix 
)
virtual
virtual unsigned int DtVrfNameGenerator::maxNameLengthForType ( const DtObjectType objectType) const
virtual
Returns
The max allowable length for a object of the specified type. This method looks up the parameters for the object type and returns a value based on the type of network interface specified in the parameters.
virtual DtString DtVrfNameGenerator::generateUniqueName ( int  maxLength,
const DtString root = "Object" 
)
virtual

Generates a name string which does not belong to any other object in the simulation, and does not exceed the maxLength. The optional root argument will be used as a starting point for the generated name.

virtual DtString DtVrfNameGenerator::nextNameWithPrefix ( int  maxLength,
const DtString potentialPrefix 
)
virtual

Returns a new unique name given the prefix (stripped of numbers, if there are some at the end) that conforms to the maximum length.

virtual DtString DtVrfNameGenerator::nextUnorganizedName ( )
virtual
virtual bool DtVrfNameGenerator::parseName ( const DtString name,
DtString shortName,
int number 
) const
virtual

Returns the short name and a number. Will return true if this is a valid format of <short name>=""> <number>

virtual void DtVrfNameGenerator::processSimObjectDeleted ( DtSimObjectReference  )
protectedvirtual
virtual void DtVrfNameGenerator::processSimObjectAdded ( DtSimObjectReference  )
protectedvirtual
virtual void DtVrfNameGenerator::processSimObjectRenamed ( const DtSimObject ,
const DtString oldText,
const DtString newText 
)
protectedvirtual
virtual DtString DtVrfNameGenerator::createPullFrom ( const DtString current,
int  low,
int  high 
) const
protectedvirtual

Creates a pull range from the given and the new range of numbers.

virtual void DtVrfNameGenerator::giveBack ( const DtString shortName,
int  number 
)
protectedvirtual

Gives the number back for the short name and does the pull correctly.

virtual void DtVrfNameGenerator::take ( const DtString shortName,
int  number,
bool  affectDuplicateCount = false 
)
protectedvirtual

Takes the number and removes from pull or does the right thing with next number.

virtual int DtVrfNameGenerator::getNextNumber ( const DtString )
protectedvirtual

Returns the next available number for the root.

virtual void DtVrfNameGenerator::takeFromRange ( Ranges ,
int  number 
) const
protectedvirtual

Takes the number from the range and returns the new range string.

Member Data Documentation

DtSimulationServices* DtVrfNameGenerator::mySimulationServices
protected
tbb::recursive_mutex DtVrfNameGenerator::myMutex
protected
tbb::atomic<int> DtVrfNameGenerator::myNextUnorganizedName
protected
NameGenerationMap DtVrfNameGenerator::myNameGenerationMap
protected
boost::signals2::scoped_connection DtVrfNameGenerator::mySimObjectAddedConnection
protected
boost::signals2::scoped_connection DtVrfNameGenerator::mySimObjectDeletedConnection
protected
boost::signals2::scoped_connection DtVrfNameGenerator::mySimObjectRenamedConnection
protected

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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)