IndexPair Class Reference


Detailed Description

Index type which uses a pair of IndexCount values for the index mapping.

adsk::Data::Stream objects contain a list of data elements. Each element has to be accessed by Index. This is one of the more general index types, a pair of IndexCount values. An adsk::Data::IndexPair element is used to lookup the physical location of a data element, either directly in an array using the dense mode or indirectly through a mapping in the sparse, or mapping, mode.

#include <adskDataIndexPair.h>

Inheritance diagram for IndexPair:

List of all members.

Public Member Functions

 IndexPair (IndexCount firstValue, IndexCount secondValue)
 Conversion constructor.
 IndexPair (const IndexPair &rhs)
 Copy constructor, simplest level.
 IndexPair (const std::string &value)
 Construct an IndexPair from a string containing the two values.
virtual ~IndexPair ()
 Default destructor, nothing to do.
IndexPairoperator= (const IndexPair &rhs)
 Class assignment operator.
void getIndexPair (IndexCount &first, IndexCount &second) const
 Get the two values comprising this index pair.
virtual std::string asString () const
 Get the IndexPair in string form.
virtual bool supportsDenseMode () const
 Notifies users that this index type can be packed densely.
virtual IndexCount denseSpaceBetween (const IndexType &rhs) const
 Calculate the dense space occupied between two index pairs.
virtual bool operator== (const IndexType &rhs) const
 Equality operator, checks if this IndexPair is the same as another Objects of different types are defined as not equal.
virtual bool operator!= (const IndexType &rhs) const
 Inequality operator, checks if this IndexPair is not the same as another Objects of different types are defined as not equal.
virtual bool operator< (const IndexType &rhs) const
 Less-than operator, checks if this IndexPair is less than another Operator sorts by typeid if the object passed in is not an IndexPair.
virtual bool operator<= (const IndexType &rhs) const
 Less-or-equal operator, checks if this IndexPair is <= another Operator sorts by typeid if the object passed in is not an IndexPair.
virtual bool operator> (const IndexType &rhs) const
 Greater-than operator, checks if this IndexPair is greater than another Operator sorts by typeid if the object passed in is not an IndexPair.
virtual bool operator>= (const IndexType &rhs) const
 Greater-or-equal operator, checks if this IndexPair is >= another Operator sorts by typeid if the object passed in is not an IndexPair.
virtual bool operator== (const IndexPair &rhs) const
 Equality operator, checks if this IndexPair is the same as another.
virtual bool operator!= (const IndexPair &rhs) const
 Inequality operator, checks if this IndexPair is not the same as another.
virtual bool operator< (const IndexPair &rhs) const
 Less-than operator, checks if this IndexPair is less than another.
virtual bool operator<= (const IndexPair &rhs) const
 Less-or-equal operator, checks if this IndexPair is <= another.
virtual bool operator> (const IndexPair &rhs) const
 Greater-than operator, checks if this IndexPair is greater than another.
virtual bool operator>= (const IndexPair &rhs) const
 Greater-or-equal operator, checks if this IndexPair is >= another.

Static Public Member Functions

static bool Debug (const IndexPair *me, adsk::Debug::Print &request)
 Answer a Print request for the IndexPair type.
static bool Debug (const IndexPair *me, adsk::Debug::Footprint &request)
 Answer a footprint request for the IndexPair type.

Protected Member Functions

 IndexPair ()
 Default constructor, should never be used.

Protected Attributes

IndexCount fSecondIndex
 First index used for mapping.

Static Protected Attributes

static std::string myTypeName = "pair"
 Name used to identify this type.
static IndexRegistration myRegistration
 Name used to identify this type.

Friends

class CRTP_IndexType< IndexPair >
 Second index used for mapping.

Constructor & Destructor Documentation

IndexPair ( IndexCount  firstIndex,
IndexCount  secondIndex 
)

Conversion constructor.

Parameters:
[in]firstIndexOne of the IndexCounts
[in]secondIndexThe other of the IndexCounts
IndexPair ( const IndexPair rhs)

Copy constructor, simplest level.

Parameters:
[in]rhsIndexPair data to be copied
IndexPair ( const std::string &  value)

Construct an IndexPair from a string containing the two values.

Parameters:
[in]valueString with format "### ###" containing the two index values
Exceptions:
Index::kBadSyntaxNon-numeric values, or less than 2 numbers
Index::kExcessDataMore than 2 numbers in the string

Member Function Documentation

IndexPair & operator= ( const IndexPair rhs)

Class assignment operator.

Parameters:
[in]rhsIndexPair data to be copied
void getIndexPair ( IndexCount &  first,
IndexCount &  second 
) const

Get the two values comprising this index pair.

Parameters:
[out]firstFirst index value of the pair
[out]secondSecond index value of the pair
std::string asString ( ) const [virtual]

Get the IndexPair in string form.

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

Implements IndexType.

bool supportsDenseMode ( ) const [virtual]

Notifies users that this index type can be packed densely.

Returns:
true, indicating that this index type can be used in dense mode

Implements IndexType.

IndexCount denseSpaceBetween ( const IndexType rhs) const [virtual]

Calculate the dense space occupied between two index pairs.

An index pair can be thought of as a matrix so the space occupied by densely packing that matrix [a,b] - [c,d] equals the integral area of a subsection of the infinite matrix at those coordinates

b d +-------------------------+ | | a| XXXXXXXXXXXXXX | | XXXXXXXXXXXXXX | | XXXXXXXXXXXXXX | | XXXXXXXXXXXXXX | | XXXXXXXXXXXXXX | c| XXXXXXXXXXXXXX | | | +-------------------------+

Parameters:
[in]rhsThe other object from whom packing space is to be calculated
Returns:
Size of that sub-matrix occupied between the pairs, including the rows and columns occupied by the endpoints. Returns 0 if the dense packing cannot be supported.

Implements IndexType.

bool operator== ( const IndexType rhs) const [virtual]

Equality operator, checks if this IndexPair is the same as another Objects of different types are defined as not equal.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if the two IndexPair objects have the same underlying IndexCounts

Implements IndexType.

bool operator!= ( const IndexType rhs) const [virtual]

Inequality operator, checks if this IndexPair is not the same as another Objects of different types are defined as not equal.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if the two IndexPair objects have a different underlying IndexCount

Implements IndexType.

bool operator< ( const IndexType rhs) const [virtual]

Less-than operator, checks if this IndexPair is less than another Operator sorts by typeid if the object passed in is not an IndexPair.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair's counter is less than rhs's

Implements IndexType.

bool operator<= ( const IndexType rhs) const [virtual]

Less-or-equal operator, checks if this IndexPair is <= another Operator sorts by typeid if the object passed in is not an IndexPair.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair's counter is less than or equal to rhs's

Implements IndexType.

bool operator> ( const IndexType rhs) const [virtual]

Greater-than operator, checks if this IndexPair is greater than another Operator sorts by typeid if the object passed in is not an IndexPair.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair's counter is greater than rhs's

Implements IndexType.

bool operator>= ( const IndexType rhs) const [virtual]

Greater-or-equal operator, checks if this IndexPair is >= another Operator sorts by typeid if the object passed in is not an IndexPair.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair's counter is greater than or equal to rhs's

Implements IndexType.

bool operator== ( const IndexPair rhs) const [virtual]

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

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if the two IndexPair objects have the same underlying IndexCounts
bool operator!= ( const IndexPair rhs) const [virtual]

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

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if the two IndexPair objects have different underlying IndexCounts
bool operator< ( const IndexPair rhs) const [virtual]

Less-than operator, checks if this IndexPair is less than another.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair is less than rhs's
bool operator<= ( const IndexPair rhs) const [virtual]

Less-or-equal operator, checks if this IndexPair is <= another.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair is less than or equal to rhs's
bool operator> ( const IndexPair rhs) const [virtual]

Greater-than operator, checks if this IndexPair is greater than another.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair is greater than rhs's
bool operator>= ( const IndexPair rhs) const [virtual]

Greater-or-equal operator, checks if this IndexPair is >= another.

Parameters:
[in]rhsIndexPair to be compared
Returns:
true if this IndexPair is greater than or equal to rhs's
bool Debug ( const IndexPair me,
adsk::Debug::Print request 
) [static]

Answer a Print request for the IndexPair type.

Use the request object to dump all information on the "me" IndexPair, or all static IndexPair information if "me" is NULL.

Parameters:
[in]mePointer to object to debug, NULL means class static
[out]requestPrint request object
Returns:
True if the request was successfully processed.
bool Debug ( const IndexPair me,
adsk::Debug::Footprint request 
) [static]

Answer a footprint request for the IndexPair type.

Populate the Footprint request with the information on all data stored within this class if "me" is NULL, otherwise the information stored in the IndexPair object pointed at by "me".

Parameters:
[in]mePointer to object to footprint, NULL means class static
[out]requestFootprint object to populate
Returns:
True if the request was successfully processed. The Footprint object will have all information added to it.

IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair
IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair IndexPair