C++ API Reference
|
Lightweight class handling index values. More...
#include <adskDataIndex.h>
Public Types | |
typedef Index(* | IndexCreator) (const std::string &) |
Further data for complex index types. | |
Public Member Functions | |
Index (IndexCount value) | |
Conversion constructor. More... | |
Index (const Index &rhs) | |
Copy constructor, simplest level. More... | |
Index (const IndexType &rhs) | |
Conversion constructor. More... | |
Index (const std::string &indexValue) | |
Constructor based on an index value in a string. More... | |
~Index () | |
Default destructor, release the ComplexIndex if there is one. | |
Index & | operator= (IndexCount rhs) |
IndexCount assignment operator. More... | |
Index & | operator= (const Index &rhs) |
Class assignment operator. More... | |
operator IndexCount () const | |
IndexCount cast operator. | |
IndexCount | index () const |
IndexCount extraction. More... | |
operator IndexType * () | |
IndexType* cast operator. | |
std::string | asString () const |
Get the Index in string form. More... | |
IndexType * | complexIndex () |
Quick access to the complex index, if it's used. More... | |
bool | supportsDenseMode () const |
Notifies users that this index type can be packed densely. More... | |
IndexCount | denseSpaceBetween (const Index &rhs) const |
Calculate the dense space occupied between two indices. More... | |
bool | operator== (const Index &rhs) const |
Equality operator, checks if this Index is the same as another. More... | |
bool | operator!= (const Index &rhs) const |
Inequality operator, checks if this Index is not the same as another. More... | |
bool | operator< (const Index &rhs) const |
Less-than operator, checks if this Index is less than another Put simple index types before complex ones. More... | |
bool | operator<= (const Index &rhs) const |
Less-or-equal operator, checks if this Index is <= another Put simple index types before complex ones. More... | |
bool | operator> (const Index &rhs) const |
Greater-than operator, checks if this Index is greater than another Put simple index types before complex ones. More... | |
bool | operator>= (const Index &rhs) const |
Greater-or-equal operator, checks if this Index is >= another Put simple index types before complex ones. More... | |
std::string | typeName () const |
Get the type name of this object. More... | |
Static Public Member Functions | |
static bool | Debug (const Index *me, Debug::Print &request) |
Answer a Print request for an Index object. More... | |
static bool | Debug (const Index *me, Debug::Footprint &request) |
Answer a footprint request for an Index object. More... | |
static Index | doCreate (const std::string &, const std::string &) |
Create an Index of a given type from a string description of the value. More... | |
static IndexCreator | creator (const std::string &) |
Get a function for construction of a given index type. More... | |
static std::string | theTypeName () |
Get the type name of the simple index type. More... | |
Lightweight class handling index values.
adsk::Data::Stream objects contain a list of data elements. Each element has to be accessed by index. In the simplest case the index is an array index (of type IndexCount, whose typedef appears above) but there can be more complex cases as well, such as a pair of integers, or a string.
This is the base class used by the adsk::Data:Stream indexing system. It is configured to be as efficient as possible in the simple index case while allowing extension to arbitrary index types. The simple integer index value is contained within this class. More complex index types are stored in a letter class of type "IndexType".
It can be used as the basis of a mapping from a general index type onto an adsk::Data::Index value, used for data referencing. Its purpose is to overload the concept of a general std::map<Index, Index> so that in the simple case where Index is the same as Index no mapping is required. The calling classes are responsible for creating that relationship, the methods in this class are defined to support that use.
Index | ( | IndexCount | rhs | ) |
Conversion constructor.
[in] | rhs | IndexCount value to be copied |
Copy constructor, simplest level.
[in] | rhs | Index data to be copied |
Conversion constructor.
[in] | rhs | ComplexIndex value to be copied |
Index | ( | const std::string & | value | ) |
Constructor based on an index value in a string.
[in] | value | Index value for construction, must be a single numeric value |
Index::kBadSyntax | Non-numeric values present, or no number present |
Index::kExcessData | More than just a single number present |
Index & operator= | ( | IndexCount | rhs | ) |
IndexCount assignment operator.
[in] | rhs | IndexCount value to be copied |
Class assignment operator.
[in] | rhs | Index data to be copied |
IndexCount index | ( | ) | const |
IndexCount extraction.
std::string asString | ( | ) | const |
Get the Index in string form.
|
inline |
Quick access to the complex index, if it's used.
bool supportsDenseMode | ( | ) | const |
Notifies users that this index type can be packed densely.
IndexCount denseSpaceBetween | ( | const Index & | rhs | ) | const |
Calculate the dense space occupied between two indices.
Dense packing of a linear index requires the number of elements between the two indices - easy peasy.
[in] | rhs | The Index from which the density is to be calculated |
bool operator== | ( | const Index & | rhs | ) | const |
bool operator!= | ( | const Index & | rhs | ) | const |
bool operator< | ( | const Index & | rhs | ) | const |
bool operator<= | ( | const Index & | rhs | ) | const |
bool operator> | ( | const Index & | rhs | ) | const |
bool operator>= | ( | const Index & | rhs | ) | const |
|
static |
Answer a Print request for an Index object.
Use the request object to dump all information on the "me" Index, or all static Index information if "me" is NULL.
[in] | me | Pointer to object to debug, NULL means class static |
[out] | request | Print request object |
|
static |
Answer a footprint request for an Index object.
Populate the Footprint request with the information on all data stored within this class if "me" is NULL, otherwise the information stored in the Index object pointed at by "me".
[in] | me | Pointer to object to footprint, NULL means class static |
[out] | request | Footprint object to populate |
|
static |
Create an Index of a given type from a string description of the value.
If the creation failed for any reason, e.g. unrecognized type or invalid string value, then an exception is thrown.
|
static |
Get a function for construction of a given index type.
Although the doCreate() method will create any type of index from a pair of strings when you are processing a whole series of index values of the same type there is no need to re-parse the type name for every index. In those cases you can access the creation function directly with this method and then call it repeatedly with the set of value strings. (e.g. in file I/O)
[in] | typeName | Name of the Index type for eventual construction |
|
static |
Get the type name of the simple index type.
Other index types require creation of a complex member.
std::string typeName | ( | ) | const |
Get the type name of this object.
If it's a simple type then the type name is this object's name, otherwise it's the name of the fComplexIndex member.