SurgSim::DataStructures::DataGroup Class Reference

A collection of NamedData objects. More...

`#include <SurgSim/DataStructures/DataGroup.h>`

## Public Types

typedef SurgSim::Math::RigidTransform3d | PoseType
| The type used for poses. More...
typedef SurgSim::Math::Vector3d | VectorType
| The type used for vectors. More...
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | DynamicMatrixType
| The type used for matrices. More...
typedef double | ScalarType
| The type used for scalars. More...
typedef int | IntegerType
| The type used for integers. More...
typedef bool | BooleanType
| The type used for booleans. More...
typedef std::string | StringType
| The type used for strings. More...
typedef Image< float > | ImageType
| The type used for images. More...

## Public Member Functions

| DataGroup ()
| Construct an empty object, with no associated names and indices yet. More...
| DataGroup (const DataGroup &dataGroup)
| Construct an object as a copy of the data from another object. More...
DataGroup & | operator= (const DataGroup &dataGroup)
| Copy the data from another object. More...
DataGroup & | operator= (DataGroup &&dataGroup)
| Move the data from another object. More...
NamedData< PoseType > & | poses ()
| Return the pose data structure. More...
const NamedData< PoseType > & | poses () const
| Return the pose data structure. More...
NamedData< VectorType > & | vectors ()
| Return the vector data structure. More...
const NamedData< VectorType > & | vectors () const
| Return the vector data structure. More...
NamedData< DynamicMatrixType > & | matrices ()
| Return the matrix data structure. More...
const NamedData< DynamicMatrixType > & | matrices () const
| Return the matrix data structure. More...
NamedData< ScalarType > & | scalars ()
| Return the scalar data structure. More...
const NamedData< ScalarType > & | scalars () const
| Return the scalar data structure. More...
NamedData< IntegerType > & | integers ()
| Return the integer data structure. More...
const NamedData< IntegerType > & | integers () const
| Return the integer data structure. More...
NamedData< BooleanType > & | booleans ()
| Return the boolean data structure. More...
const NamedData< BooleanType > & | booleans () const
| Return the boolean data structure. More...
NamedData< StringType > & | strings ()
| Return the string data structure. More...
const NamedData< StringType > & | strings () const
| Return the string data structure. More...
NamedData< ImageType > & | images ()
| Return the image data structure. More...
const NamedData< ImageType > & | images () const
| Return the image data structure. More...
NamedVariantData & | customData ()
| Return the custom data structure. More...
const NamedVariantData & | customData () const
| Return the custom data structure. More...
void | resetAll ()
| Mark all data as not current. More...
bool | isEmpty () const
| An empty DataGroup can be assigned to by any DataGroup with only valid NamedData. More...

## Private Attributes

NamedData< PoseType > | m_poses
| The pose values. More...
NamedData< VectorType > | m_vectors
| The vector values. More...
NamedData< DynamicMatrixType > | m_matrices
| The matrix values. More...
NamedData< ScalarType > | m_scalars
| The scalar values. More...
NamedData< IntegerType > | m_integers
| The integer values. More...
NamedData< BooleanType > | m_booleans
| The boolean values. More...
NamedData< StringType > | m_strings
| The string values. More...
NamedData< ImageType > | m_images
| The string values. More...
NamedVariantData | m_customData
| The custom data values. More...

## Detailed Description

A collection of NamedData objects.

A DataGroup object contains a NamedData for each of several predefined types:

- Booleans contain a Boolean logic value (true or false).
- Images contain float images.
- Integers contain an integer value.
- Poses contain the position and orientation of an object in space, represented as a 3D rigid-body (isometric) transformation.
- Matrices contain a matrix.
- Scalars contain a scalar value (i.e. anything that can be represented as a double).
- Strings contain a text value.
- Vectors contain a vector quantity that does not change when the coordinate system is translated, such as a force or an oriented distance.
- CustomData contain a custom data structure, NamedVariantData.

The entries (names and indices) are unique within each NamedData member, but not necessarily across different types (i.e. there could be a scalar and a vector both named "friction", or a pose and a boolean both at index 1). It is recommended that you keep names separate between different types to avoid confusion.

A DataGroup object constructed by the default constructor starts out empty, meaning all its NamedData member objects are "invalid". An empty DataGroup object can be made non-empty by:

- using the DataGroupBuilder class,
- copy construction,
- assigning from a non-empty DataGroup object, or
- assigning a "valid" NamedData object (of the correct template type) to one or more NamedData members.

Assignment to a non-empty DataGroup object is only possible if either of the two objects in the assignment was made non-empty based on the other object (see the above list items about copy construction and assignment from a non-empty DataGroup object).

Once a DataGroup is non-empty, the "entries" (i.e., the strings and indices that are used to access the data) cannot be changed, added to, removed from, or made empty. These properties ensure that a stable data layout is available to the code using this class. For example, the calling code can cache the entries' indices and from then on use the faster index-based lookup instead of the slower string-based lookup.

See also
  SurgSim::DataStructures::NamedData, SurgSim::DataStructers::DataGroupBuilder

## Member Typedef Documentation

## BooleanType

typedef bool SurgSim::DataStructures::DataGroup::BooleanType

The type used for booleans.

## DynamicMatrixType

typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> SurgSim::DataStructures::DataGroup::DynamicMatrixType

The type used for matrices.

## ImageType

typedef Image<float> SurgSim::DataStructures::DataGroup::ImageType

The type used for images.

## IntegerType

typedef int SurgSim::DataStructures::DataGroup::IntegerType

The type used for integers.

## PoseType

typedef SurgSim::Math::RigidTransform3d SurgSim::DataStructures::DataGroup::PoseType

The type used for poses.

## ScalarType

typedef double SurgSim::DataStructures::DataGroup::ScalarType

The type used for scalars.

## StringType

typedef std::string SurgSim::DataStructures::DataGroup::StringType

The type used for strings.

## VectorType

typedef SurgSim::Math::Vector3d SurgSim::DataStructures::DataGroup::VectorType

The type used for vectors.

## Constructor & Destructor Documentation

## DataGroup() [1/2]

SurgSim::DataStructures::DataGroup::DataGroup | ( |  | ) |

Construct an empty object, with no associated names and indices yet.

## DataGroup() [2/2]

SurgSim::DataStructures::DataGroup::DataGroup | ( | const DataGroup & | dataGroup | ) |

Construct an object as a copy of the data from another object.

Parameters

  dataGroup | The object to copy from.

## Member Function Documentation

## booleans() [1/2]

NamedData< DataGroup::BooleanType > & SurgSim::DataStructures::DataGroup::booleans | ( |  | ) |

Return the boolean data structure.

Returns
  the mutable Boolean data.

## booleans() [2/2]

const NamedData< DataGroup::BooleanType > & SurgSim::DataStructures::DataGroup::booleans | ( |  | ) | const

Return the boolean data structure.

Returns
  the read-only Boolean data.

## customData() [1/2]

NamedVariantData & SurgSim::DataStructures::DataGroup::customData | ( |  | ) |

Return the custom data structure.

Returns
  the mutable data.

## customData() [2/2]

const NamedVariantData & SurgSim::DataStructures::DataGroup::customData | ( |  | ) | const

Return the custom data structure.

Returns
  the read-only data.

## images() [1/2]

NamedData< DataGroup::ImageType > & SurgSim::DataStructures::DataGroup::images | ( |  | ) |

Return the image data structure.

Returns
  the mutable iamge data.

## images() [2/2]

const NamedData< DataGroup::ImageType > & SurgSim::DataStructures::DataGroup::images | ( |  | ) | const

Return the image data structure.

Returns
  the read-only images data.

## integers() [1/2]

NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers | ( |  | ) |

Return the integer data structure.

Returns
  the mutable integer data.

## integers() [2/2]

const NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers | ( |  | ) | const

Return the integer data structure.

Returns
  the read-only integer data.

## isEmpty()

bool SurgSim::DataStructures::DataGroup::isEmpty | ( |  | ) | const

An empty DataGroup can be assigned to by any DataGroup with only valid NamedData.

return true if all the NamedData are invalid.

## matrices() [1/2]

NamedData< DataGroup::DynamicMatrixType > & SurgSim::DataStructures::DataGroup::matrices | ( |  | ) |

Return the matrix data structure.

Returns
  the mutable matrix data.

## matrices() [2/2]

const NamedData< DataGroup::DynamicMatrixType > & SurgSim::DataStructures::DataGroup::matrices | ( |  | ) | const

Return the matrix data structure.

Returns
  the read-only matrix data.

## operator=() [1/2]

DataGroup & SurgSim::DataStructures::DataGroup::operator= | ( | const DataGroup & | dataGroup | ) |

Copy the data from another object.

The object being assigned into must either be empty (not yet associated with a set of names and indices), or the two objects must share the same data layout, resulting from earlier copy construction or assignment.

DataGroup initial;
// ...initialize "initial" to some non-empty value...
DataGroup copyConstructed(initial); // Layout is shared with initial
copyConstructed = initial // OK, using the same layout
DataGroup another; // Object is empty (no layout)
another = initial; // OK, layout is now shared with initial
another = initial // OK, using the same layout

Note that the data layout must be the same, i.e. related to one another by object assignment or copy construction. Objects that merely contain entries with the same names and indices are not acceptable! (Otherwise, we'd need to inefficiently compare layout contents each time we assign.)

DataGroupBuilder builder;
// ...initialize the entries in the builder...
NamedData first = builder.createData(); // Layout of entries created from builder
NamedData second = builder.createData(); // Another layout of entries created; names and indices match
second = first; // ERROR at run-time, layouts were created separately!

Parameters

  dataGroup | The object to copy from.

Returns
  The object that was assigned into.

## operator=() [2/2]

DataGroup & SurgSim::DataStructures::DataGroup::operator= | ( | DataGroup && | dataGroup | ) |

Move the data from another object.

The same restrictions on object compatibility apply as in the case of the copy assignment operator=(const DataGroup&).

Parameters

  [in,out] | dataGroup | The object to copy from, which will be left in an unusable state.

Returns
  The object that was assigned into.

## poses() [1/2]

NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses | ( |  | ) |

Return the pose data structure.

Returns
  the mutable pose data.

## poses() [2/2]

const NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses | ( |  | ) | const

Return the pose data structure.

Returns
  the read-only pose data.

## resetAll()

void SurgSim::DataStructures::DataGroup::resetAll | ( |  | ) |

Mark all data as not current.

## scalars() [1/2]

NamedData< DataGroup::ScalarType > & SurgSim::DataStructures::DataGroup::scalars | ( |  | ) |

Return the scalar data structure.

Returns
  the mutable scalar data.

## scalars() [2/2]

const NamedData< DataGroup::ScalarType > & SurgSim::DataStructures::DataGroup::scalars | ( |  | ) | const

Return the scalar data structure.

Returns
  the read-only scalar data.

## strings() [1/2]

NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings | ( |  | ) |

Return the string data structure.

Returns
  the mutable string data.

## strings() [2/2]

const NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings | ( |  | ) | const

Return the string data structure.

Returns
  the read-only string data.

## vectors() [1/2]

NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors | ( |  | ) |

Return the vector data structure.

Returns
  the mutable vector data.

## vectors() [2/2]

const NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors | ( |  | ) | const

Return the vector data structure.

Returns
  the read-only vector data.

## Member Data Documentation

## m_booleans

NamedData<BooleanType> SurgSim::DataStructures::DataGroup::m_booleans

private

The boolean values.

## m_customData

NamedVariantData SurgSim::DataStructures::DataGroup::m_customData

private

The custom data values.

## m_images

NamedData<ImageType> SurgSim::DataStructures::DataGroup::m_images

private

The string values.

## m_integers

NamedData<IntegerType> SurgSim::DataStructures::DataGroup::m_integers

private

The integer values.

## m_matrices

NamedData<DynamicMatrixType> SurgSim::DataStructures::DataGroup::m_matrices

private

The matrix values.

## m_poses

NamedData<PoseType> SurgSim::DataStructures::DataGroup::m_poses

private

The pose values.

## m_scalars

NamedData<ScalarType> SurgSim::DataStructures::DataGroup::m_scalars

private

The scalar values.

## m_strings

NamedData<StringType> SurgSim::DataStructures::DataGroup::m_strings

private

The string values.

## m_vectors

NamedData<VectorType> SurgSim::DataStructures::DataGroup::m_vectors

private

The vector values.

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

- SurgSim/DataStructures/DataGroup.h
- SurgSim/DataStructures/DataGroup.cpp