- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# Index Class Reference

This reference page is linked to from the following overview topics: Meta Data.

Search for all occurrences

## Detailed Description

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.

`#include <adskDataIndex.h>`

List of all members.

## Public Types
typedef Index(* | IndexCreator )(const std::string &)
| False if using fIndex and simple IndexCount index types, otherwise use fComplexIndex.
## Public Member Functions
| Index (IndexCount value)
| Conversion constructor.
| Index (const Index &rhs)
| Copy constructor, simplest level.
| Index (const IndexType &rhs)
| Conversion constructor.
| Index (const std::string &indexValue)
| Constructor based on an index value in a string. Search for all occurrences
| ~Index ()
| Default destructor, release the ComplexIndex if there is one.
Index & | operator= (IndexCount rhs)
| IndexCount assignment operator.
Index & | operator= (const Index &rhs)
| Class assignment operator.
| operator IndexCount () const
| IndexCount cast operator.
IndexCount | index () const
| IndexCount extraction.
| operator IndexType * ()
| IndexType* cast operator.
std::string | asString () const
| Get the Index in string form.
IndexType * | complexIndex ()
| 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.
bool | operator== (const Index &rhs) const
| Equality operator, checks if this Index is the same as another.
bool | operator!= (const Index &rhs) const
| Inequality operator, checks if this Index is not the same as another.
bool | operator< (const Index &rhs) const
| Less-than operator, checks if this Index is less than another Put simple index types before complex ones.
bool | operator<= (const Index &rhs) const
| Less-or-equal operator, checks if this Index is <= another Put simple index types before complex ones.
bool | operator> (const Index &rhs) const
| Greater-than operator, checks if this Index is greater than another Put simple index types before complex ones.
bool | operator>= (const Index &rhs) const
| Greater-or-equal operator, checks if this Index is >= another Put simple index types before complex ones.
std::string | typeName () const
| Get the type name of this object.
## Static Public Member Functions
static bool | Debug (const Index *me, Debug::Print &request)
| Answer a Print request for an Index object.
static bool | Debug (const Index *me, Debug::Footprint &request)
| Answer a footprint request for an Index object.
static Index | doCreate (const std::string &, const std::string &)
| Create an Index of a given type from a string description of the value.
static IndexCreator | creator (const std::string &)
| Get a function for construction of a given index type.
static std::string | theTypeName ()
| Get the type name of the simple index type.

## Constructor & Destructor Documentation

Index | ( | IndexCount | rhs | ) |

Conversion constructor.

Parameters:

  [in] | rhs | IndexCount value to be copied

Index | ( | const Index & | rhs | ) |

Copy constructor, simplest level.

Parameters:

  [in] | rhs | Index data to be copied

Index | ( | const IndexType & | rhs | ) |

Conversion constructor.

Parameters:

  [in] | rhs | ComplexIndex value to be copied

Index | ( | const std::string & | value | ) |

Constructor based on an index value in a string.

Parameters:

  [in] | value | Index value for construction, must be a single numeric value

Exceptions:

  Index::kBadSyntax | Non-numeric values present, or no number present
  Index::kExcessData | More than just a single number present

## Member Function Documentation

Index & operator= | ( | IndexCount | rhs | ) |

IndexCount assignment operator.

Parameters:

  [in] | rhs | IndexCount value to be copied

Index & operator= | ( | const Index & | rhs | ) |

Class assignment operator.

Parameters:

  [in] | rhs | Index data to be copied

IndexCount index | ( |  | ) | const

Search for all occurrences

IndexCount extraction.

Returns:
  Single array index associated with this Index

std::string asString | ( |  | ) | const

Search for all occurrences

Get the Index in string form.

Returns:
  String representing the index value (in the same form expected by the creator functions)

IndexType * complexIndex | ( |  | ) | `[inline]`

Search for all occurrences

Quick access to the complex index, if it's used.

Returns:
  Pointer to the complex index type, or NULL if the index is simple

bool supportsDenseMode | ( |  | ) | const

Search for all occurrences

Notifies users that this index type can be packed densely.

Returns:
  ComplexIndex dense support if it exists, otherwise true since the default index type supports density.

IndexCount denseSpaceBetween | ( | const Index & | rhs | ) | const

Search for all occurrences

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.

Parameters:

  [in] | rhs | The Index from which the density is to be calculated

Returns:
  Number of elements betweeen this one and the parameter, including both of the endpoints. Returns 0 if the dense packing cannot be supported.

bool operator== | ( | const Index & | rhs | ) | const

Equality operator, checks if this Index is the same as another.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if the two Index objects have the same underlying IndexCount

bool operator!= | ( | const Index & | rhs | ) | const

Inequality operator, checks if this Index is not the same as another.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if the two Index objects have a different underlying IndexCount

bool operator< | ( | const Index & | rhs | ) | const

Less-than operator, checks if this Index is less than another Put simple index types before complex ones.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if this Index's counter is less than rhs's

bool operator<= | ( | const Index & | rhs | ) | const

Less-or-equal operator, checks if this Index is <= another Put simple index types before complex ones.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if this Index's counter is less than or equal to rhs's

bool operator> | ( | const Index & | rhs | ) | const

Greater-than operator, checks if this Index is greater than another Put simple index types before complex ones.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if this Index's counter is greater than rhs's

bool operator>= | ( | const Index & | rhs | ) | const

Greater-or-equal operator, checks if this Index is >= another Put simple index types before complex ones.

Parameters:

  [in] | rhs | Index to be compared

Returns:
  true if this Index's counter is greater than or equal to rhs's

bool Debug | ( | const Index * | me,
|  | Debug::Print & | request
| ) |  | `[static]`

Search for all occurrences

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.

Parameters:

  [in] | me | Pointer to object to debug, NULL means class static
  [out] | request | Print request object

Returns:
  True if the request was successfully processed.

bool Debug | ( | const Index * | me,
|  | Debug::Footprint & | request
| ) |  | `[static]`

Search for all occurrences

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".

Parameters:

  [in] | me | Pointer to object to footprint, NULL means class static
  [out] | request | Footprint object to populate

Returns:
  True if the request was successfully processed. The Footprint object will have all information added to it.

Index doCreate | ( | const std::string & | typeName,
|  | const std::string & | value
| ) |  | `[static]`

Search for all occurrences

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.

Parameters:

  [in] | typeName | Name of the Index type
  [in] | value | String which defines the Index value

Returns:
  True if the request was successfully processed.

Index::IndexCreator creator | ( | const std::string & | typeName | ) | `[static]`

Search for all occurrences

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)

Parameters:

  [in] | typeName | Name of the Index type for eventual construction

Returns:
  Function that will construct an index of the given type from a string with its value.

std::string theTypeName | ( |  | ) | `[static]`

Search for all occurrences

Get the type name of the simple index type.

Other index types require creation of a complex member.

Returns:
  String with the simple index type name

std::string typeName | ( |  | ) | const

Search for all occurrences

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.

Returns:
  String with this index type's name

Index Index Index Index Index Index Index Index Index Index
Index Index Index Index Index Index Index Index Index Index