All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
SurgSim::DataStructures::DataGroup Class Reference

A collection of NamedData objects. More...

#include <SurgSim/DataStructures/DataGroup.h>

Collaboration diagram for SurgSim::DataStructures::DataGroup:
Collaboration graph
[legend]

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

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...
 
DataGroupoperator= (const DataGroup &dataGroup)
 Copy the data from another object. More...
 
DataGroupoperator= (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...
 
NamedVariantDatacustomData ()
 Return the custom data structure. More...
 
const NamedVariantDatacustomData () 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< PoseTypem_poses
 The pose values. More...
 
NamedData< VectorTypem_vectors
 The vector values. More...
 
NamedData< DynamicMatrixTypem_matrices
 The matrix values. More...
 
NamedData< ScalarTypem_scalars
 The scalar values. More...
 
NamedData< IntegerTypem_integers
 The integer values. More...
 
NamedData< BooleanTypem_booleans
 The boolean values. More...
 
NamedData< StringTypem_strings
 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:

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:

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

The type used for booleans.

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

The type used for matrices.

The type used for integers.

The type used for poses.

The type used for scalars.

The type used for strings.

The type used for vectors.

Constructor & Destructor Documentation

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

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

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

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

Parameters
dataGroupThe object to copy from.

Member Function Documentation

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

Return the boolean data structure.

Returns
the mutable Boolean data.
const NamedData< DataGroup::BooleanType > & SurgSim::DataStructures::DataGroup::booleans ( ) const

Return the boolean data structure.

Returns
the read-only Boolean data.
NamedVariantData & SurgSim::DataStructures::DataGroup::customData ( )

Return the custom data structure.

Returns
the mutable data.
const NamedVariantData & SurgSim::DataStructures::DataGroup::customData ( ) const

Return the custom data structure.

Returns
the read-only data.
NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers ( )

Return the integer data structure.

Returns
the mutable integer data.
const NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers ( ) const

Return the integer data structure.

Returns
the read-only integer data.
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.

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

Return the matrix data structure.

Returns
the mutable matrix data.
const NamedData< DataGroup::DynamicMatrixType > & SurgSim::DataStructures::DataGroup::matrices ( ) const

Return the matrix data structure.

Returns
the read-only matrix data.
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
dataGroupThe object to copy from.
Returns
The object that was assigned into.
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]dataGroupThe object to copy from, which will be left in an unusable state.
Returns
The object that was assigned into.
NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses ( )

Return the pose data structure.

Returns
the mutable pose data.
const NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses ( ) const

Return the pose data structure.

Returns
the read-only pose data.
void SurgSim::DataStructures::DataGroup::resetAll ( )

Mark all data as not current.

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

Return the scalar data structure.

Returns
the mutable scalar data.
const NamedData< DataGroup::ScalarType > & SurgSim::DataStructures::DataGroup::scalars ( ) const

Return the scalar data structure.

Returns
the read-only scalar data.
NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings ( )

Return the string data structure.

Returns
the mutable string data.
const NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings ( ) const

Return the string data structure.

Returns
the read-only string data.
NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors ( )

Return the vector data structure.

Returns
the mutable vector data.
const NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors ( ) const

Return the vector data structure.

Returns
the read-only vector data.

Member Data Documentation

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

The boolean values.

NamedVariantData SurgSim::DataStructures::DataGroup::m_customData
private

The custom data values.

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

The integer values.

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

The matrix values.

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

The pose values.

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

The scalar values.

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

The string values.

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

The vector values.


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