#include <TagManager.h>

Inheritance diagram for TagManager:

TagManager class definition. More...

Public Types

typedef std::shared_ptr< TagManagerSP
 TagManager smart pointer typedef. More...
 
typedef std::shared_ptr< const TagManagerSCP
 TagManger constant smart pointer typedef. More...
 

Public Member Functions

 TagManager ()
 Constructor. More...
 
 TagManager (const TagManager &orig)
 Copy constructor. More...
 
virtual ~TagManager ()
 Destructor. More...
 
bool hasTag (std::string name) const
 This function uses the containsType functions from DataContainer and just checks both types. More...
 
std::string getIdTag (std::string name) const
 This returns the string value of the tag passed as the parameter. More...
 
double getInterpTag (std::string name) const
 This returns the double value of the tag passed as the parameter. More...
 
Vec_Str listIdTags () const
 Overrides the getNames function in DataContainer and is used specifically to return the names of the ID tags (of type string values). There is no order. More...
 
Vec_Str listInterpTags () const
 Overrides the getNames function in DataContainer and is used specifically to return the names of the interpolatable tags (of type double values). There is no order. More...
 
Vec_Str listIdValues () const
 Return vector of id tag values in the DataContainer. More...
 
Vec_Dbl listInterpValues () const
 Return vector of interpolatable tag values in the DataContainer. More...
 
void setInterpValues (Vec_Dbl &values)
 Set interpolatable tag values by a vector. More...
 
void setIdTag (std::string name, std::string strValue)
 Set new string value to ID tag. Create new ID tag if that tag isn't already present in the current DataContainer. More...
 
void setInterpTag (std::string name, double dblValue)
 This function checks if the name provided is already in the interpolatable tags. If yes, it applies the new value to that tag name. If no, it adds the tag name and matching value. More...
 
bool deleteTag (std::string name, std::ostream &os=std::cerr)
 This function currently just uses the remove functions built into DataContainer to put the values into temporary variables and then returns void. Does this rather ham-handedly by just calling the remove functions for both types that the tag could be, abusing the inherent checks in the remove functions. In the future, could return the value, requiring that this function be split by type. More...
 
void deleteAll ()
 This function should clear out all of the tags on this tag manager. More...
 
SP clone () const
 < Deep copy method More...
 
bool operator== (const TagManager &other) const
 Equality comparison operator. More...
 
bool match (const TagManager &other) const
 This function should check the provided tag manager against the current tag manager to ensure a perfect match of tag names. This is achieved by calling the internal compare function twice, switching the arguments. If the internal compare function returns a null set both times, the two match. Otherwise, they don't match. More...
 
bool interpolationCompare (const TagManager &other) const
 Function to compare the values of a set of ID tags to ensure the two TagManagers are describing the same type of Library with different interp tags for interpolation. More...
 
Vec_Str compare (const TagManager &sp_other) const
 This function accepts a TagManager and uses the internalCompare function and returns a list of the tags that don't match between the provided TagManager and the current TagManager. More...
 
Vec_Str compare (Vec_Str desired) const
 This function is one of the overloaded compare functions that accepts a vector of tag names. It then sends the internalCompare function that vector of strings and a dereferenced pointer to this tag manager. More...
 
Scale::Json::Value to_json () const
 write to JSON More...
 
std::string to_string () const
 write to std::string More...
 
virtual Standard::Serializable::UID getUID () const
 Get serializable UID. More...
 
virtual TagManagergetCopy () const
 Clone method. More...
 
std::string toString () const
 

Static Public Attributes

static const Standard::Serializable::UID uid = 0x11111152b5b56031
 Serializable UID. More...
 

Private Member Functions

Vec_Str internalCompare (Vec_Str desired, const TagManager &other) const
 
  • Internal compare function.
More...
 
bool checkMaps ()
 This function should check all of the DataContainer types that are not string and double and ensure that they are all empty. More...
 

Friends

class ScaleUtils::IO::Accessor< TagManager >
 

Detailed Description

TagManager class definition.

Author
Nicholas C. Sly
Date
March 11, 2014
Examples:
tstGridView.cpp, tstinterp.cpp, tstLibrary.cpp, and tstTagManager.cpp.

Member Typedef Documentation

typedef std::shared_ptr<TagManager> SP

TagManager smart pointer typedef.

typedef std::shared_ptr<const TagManager> SCP

TagManger constant smart pointer typedef.

Constructor & Destructor Documentation

Constructor.

Referenced by TagManager::clone(), and TagManager::getCopy().

TagManager ( const TagManager orig)

Copy constructor.

~TagManager ( )
virtual

Destructor.

References TagManager::checkMaps().

Member Function Documentation

bool hasTag ( std::string  name) const

This function uses the containsType functions from DataContainer and just checks both types.

Parameters
name- Name of the tag being searched for (ID or interpolatable).
Returns
bool - True if a tag with that name is present. False otherwise.
Examples:
tstinterp.cpp.

Referenced by Origen::checkImplicitTags(), TagManager::deleteTag(), TagManager::interpolationCompare(), and TEST().

std::string getIdTag ( std::string  name) const

This returns the string value of the tag passed as the parameter.

Parameters
nameName of the ID tag being searched for.
Returns
Value of the ID tag being searched for.
Examples:
tstinterp.cpp.

Referenced by TagManager::clone(), TagManager::interpolationCompare(), TagManager::listIdValues(), Origen::printIdTags_json(), and TEST().

double getInterpTag ( std::string  name) const

This returns the double value of the tag passed as the parameter.

Parameters
nameName of the interpolatable tag being searched for.
Returns
Value of the interpolatable tag being searched for.
Examples:
tstinterp.cpp.

Referenced by TagManager::clone(), GridData_TransitionCoeff::getWts(), TagManager::listInterpValues(), Origen::printInterpTags_json(), and TEST().

Vec_Str listIdTags ( ) const

Overrides the getNames function in DataContainer and is used specifically to return the names of the ID tags (of type string values). There is no order.

Returns
A list of the names of all ID tags on the TagManager.

Referenced by TagManager::clone(), TagManager::compare(), TagManager::deleteAll(), TagManager::internalCompare(), TagManager::interpolationCompare(), TagManager::listIdValues(), TagManager::match(), TagManager::operator==(), Origen::printIdTags_json(), Origen::printInterpTags_json(), TagManager::to_json(), and Origen::write().

Vec_Str listInterpTags ( ) const

Overrides the getNames function in DataContainer and is used specifically to return the names of the interpolatable tags (of type double values). There is no order.

Returns
A list of the names of all interpolatable tags on the TagManager.

Referenced by TagManager::clone(), TagManager::compare(), TagManager::deleteAll(), TagManager::internalCompare(), Origen::interpLibraryND(), TagManager::interpolationCompare(), TagManager::listInterpValues(), TagManager::match(), TagManager::operator==(), Origen::printInterpTags_json(), TagManager::setInterpValues(), TagManager::to_json(), and Origen::write().

Vec_Str listIdValues ( ) const

Return vector of id tag values in the DataContainer.

Returns
Vec_Str - list of id tag names.

References TagManager::getIdTag(), and TagManager::listIdTags().

Referenced by TagManager::operator==(), TagManager::to_json(), and Origen::write().

Vec_Dbl listInterpValues ( ) const

Return vector of interpolatable tag values in the DataContainer.

Returns
Vec_Dbl - list of interpolatable tag values.

References TagManager::getInterpTag(), and TagManager::listInterpTags().

Referenced by TagManager::operator==(), TagManager::to_json(), and Origen::write().

void setInterpValues ( Vec_Dbl values)

Set interpolatable tag values by a vector.

Parameters
valueslist of interpolatable tag values (order same as listInterpTags would return).

References TagManager::listInterpTags(), and TagManager::setInterpTag().

Referenced by GridView_StateInfo::permute().

void setIdTag ( std::string  name,
std::string  strValue 
)

Set new string value to ID tag. Create new ID tag if that tag isn't already present in the current DataContainer.

This function checks if the name provided is already in the ID tags. If yes, it applies the new value to that tag name. If no, it adds the tag name and matching value.

Parameters
name- Name of the ID tag.
strValue- String value of the ID tag.
Examples:
tstinterp.cpp, and tstLibrary.cpp.

Referenced by Origen::collectLibraries(), Obiwan_tag::execute(), Obiwan_interp::execute(), Origen::read(), Accessor< Origen::TagManager >::read(), Origen::saveStateSet(), LibraryTest::SetUp(), and TEST().

void setInterpTag ( std::string  name,
double  dblValue 
)

This function checks if the name provided is already in the interpolatable tags. If yes, it applies the new value to that tag name. If no, it adds the tag name and matching value.

Parameters
name- Name of the interpolatable tag.
dblValue- Double value of the interpolatable tag.
Examples:
tstGridView.cpp, tstinterp.cpp, and tstLibrary.cpp.

Referenced by Origen::addImpliedTags(), Obiwan_interp::execute(), Obiwan_tag::execute(), FakeFactory::Library_linear2D(), Origen::read(), Accessor< Origen::TagManager >::read(), TagManager::setInterpValues(), LibraryTest::SetUp(), and TEST().

bool deleteTag ( std::string  name,
std::ostream &  os = std::cerr 
)

This function currently just uses the remove functions built into DataContainer to put the values into temporary variables and then returns void. Does this rather ham-handedly by just calling the remove functions for both types that the tag could be, abusing the inherent checks in the remove functions. In the future, could return the value, requiring that this function be split by type.

Parameters
nameName of the tag that you're looking to delete.
osOutput stream to which an error can be sent.
Returns
bool - True if the tag was found and deleted. False otherwise (i.e., tag not present).
Examples:
tstinterp.cpp.

References TagManager::hasTag().

Referenced by TagManager::deleteAll(), Obiwan_tag::execute(), and TEST().

void deleteAll ( )

This function should clear out all of the tags on this tag manager.

References TagManager::deleteTag(), TagManager::listIdTags(), and TagManager::listInterpTags().

bool operator== ( const TagManager other) const

Equality comparison operator.

Parameters
otherOther TagManager object to compare against
otherOther TagManager object to compare against
otherOther TagManager object to compare against
Returns
bool - True if match. False otherwise.
Remarks
Does approximate comparison on doubles and exact match on strings.

References TagManager::listIdTags(), TagManager::listIdValues(), TagManager::listInterpTags(), and TagManager::listInterpValues().

bool match ( const TagManager other) const

This function should check the provided tag manager against the current tag manager to ensure a perfect match of tag names. This is achieved by calling the internal compare function twice, switching the arguments. If the internal compare function returns a null set both times, the two match. Otherwise, they don't match.

Parameters
otherAnother TagManager to compare against the current TagManager.
Returns
bool - True if all of the tag names on the provided TagManager perfectly match those on the current TagManager. False otherwise.

References TagManager::internalCompare(), TagManager::listIdTags(), and TagManager::listInterpTags().

Referenced by StateInfo::match().

bool interpolationCompare ( const TagManager other) const

Function to compare the values of a set of ID tags to ensure the two TagManagers are describing the same type of Library with different interp tags for interpolation.

Parameters
other- TagManager to which the current TagManager will be compared. If the current TagManager does not contain all of the same ID and Interp tag names and all of the same ID tag values as other, this function will return false.
Returns
bool - True if the current TagManager contains all of the ID and Interp tag names found in other as well as the same matching ID tag values found in other. False otherwise.

References TagManager::compare(), TagManager::getIdTag(), TagManager::hasTag(), TagManager::listIdTags(), and TagManager::listInterpTags().

Vec_Str compare ( const TagManager sp_other) const

This function accepts a TagManager and uses the internalCompare function and returns a list of the tags that don't match between the provided TagManager and the current TagManager.

Parameters
sp_otherAnother tag manager to be compared against the current one.
Returns
A list of the tag names on the current TagManager not found on the provided TagManager.

References TagManager::internalCompare(), TagManager::listIdTags(), and TagManager::listInterpTags().

Referenced by Origen::checkImplicitTags(), and TagManager::interpolationCompare().

Vec_Str compare ( Vec_Str  desired) const

This function is one of the overloaded compare functions that accepts a vector of tag names. It then sends the internalCompare function that vector of strings and a dereferenced pointer to this tag manager.

Parameters
desiredA list of tag names that one is looking for on the current TagManager.
Returns
A list of tag names that were in desired but not on the current TagManager.

References TagManager::internalCompare().

std::string to_string ( ) const

write to std::string

References TagManager::to_json().

Referenced by TagManager::toString().

long getUID ( ) const
virtual

Get serializable UID.

References TagManager::uid.

TagManager * getCopy ( ) const
virtual

Clone method.

References TagManager::TagManager().

std::string toString ( ) const
Vec_Str internalCompare ( Vec_Str  desired,
const TagManager other 
) const
private

  • Internal compare function.

Checks for missing tags on a Library's TagManager object, based on a set of desired tag names.

This private function accepts a vector of strings that are desired tag names and a full TagManager instance from a Library. The names of the tags are taken from the full TagManager instance into a vector of strings that are the tag names present. The list of the desired tags is iterated through and if no match is found in the tags present, it is added to the list of missing tags. The list of missing tags is then returned.

Parameters
desiredList of desired tag names that we are hoping to find in the other library.
otherTagManager from the library we are checking for the desired tags.
Returns
List of tag names that were desired but not found on the library in question.

References TagManager::listIdTags(), and TagManager::listInterpTags().

Referenced by TagManager::compare(), and TagManager::match().

bool checkMaps ( )
private

This function should check all of the DataContainer types that are not string and double and ensure that they are all empty.

Returns
bool - True if all are empty. False otherwise.

Referenced by TagManager::~TagManager().

Friends And Related Function Documentation

friend class ScaleUtils::IO::Accessor< TagManager >
friend

Member Data Documentation

const Standard::Serializable::UID uid = 0x11111152b5b56031
static

Serializable UID.

Referenced by Library::deserialize(), and TagManager::getUID().


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