opensurgsim
|
A collection of NamedData objects. More...
#include <DataGroup.h>
Public Types | |
typedef SurgSim::Math::RigidTransform3d | PoseType |
The type used for poses. | |
typedef SurgSim::Math::Vector3d | VectorType |
The type used for vectors. | |
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | DynamicMatrixType |
The type used for matrices. | |
typedef double | ScalarType |
The type used for scalars. | |
typedef int | IntegerType |
The type used for integers. | |
typedef bool | BooleanType |
The type used for booleans. | |
typedef std::string | StringType |
The type used for strings. | |
typedef Image< float > | ImageType |
The type used for images. | |
Public Member Functions | |
DataGroup () | |
Construct an empty object, with no associated names and indices yet. | |
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. | |
bool | isEmpty () const |
An empty DataGroup can be assigned to by any DataGroup with only valid NamedData. More... | |
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.
SurgSim::DataStructures::DataGroup::DataGroup | ( | const DataGroup & | dataGroup | ) |
Construct an object as a copy of the data from another object.
dataGroup | The object to copy from. |
NamedData< DataGroup::BooleanType > & SurgSim::DataStructures::DataGroup::booleans | ( | ) |
Return the boolean data structure.
const NamedData< DataGroup::BooleanType > & SurgSim::DataStructures::DataGroup::booleans | ( | ) | const |
Return the boolean data structure.
NamedVariantData & SurgSim::DataStructures::DataGroup::customData | ( | ) |
Return the custom data structure.
const NamedVariantData & SurgSim::DataStructures::DataGroup::customData | ( | ) | const |
Return the custom data structure.
NamedData< DataGroup::ImageType > & SurgSim::DataStructures::DataGroup::images | ( | ) |
Return the image data structure.
const NamedData< DataGroup::ImageType > & SurgSim::DataStructures::DataGroup::images | ( | ) | const |
Return the image data structure.
NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers | ( | ) |
Return the integer data structure.
const NamedData< DataGroup::IntegerType > & SurgSim::DataStructures::DataGroup::integers | ( | ) | const |
Return the integer data structure.
bool SurgSim::DataStructures::DataGroup::isEmpty | ( | ) | const |
NamedData< DataGroup::DynamicMatrixType > & SurgSim::DataStructures::DataGroup::matrices | ( | ) |
Return the matrix data structure.
const NamedData< DataGroup::DynamicMatrixType > & SurgSim::DataStructures::DataGroup::matrices | ( | ) | const |
Return the matrix data structure.
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.
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.)
dataGroup | The object to copy from. |
Move the data from another object.
The same restrictions on object compatibility apply as in the case of the copy assignment operator=(const DataGroup&).
[in,out] | dataGroup | The object to copy from, which will be left in an unusable state. |
NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses | ( | ) |
Return the pose data structure.
const NamedData< DataGroup::PoseType > & SurgSim::DataStructures::DataGroup::poses | ( | ) | const |
Return the pose data structure.
NamedData< DataGroup::ScalarType > & SurgSim::DataStructures::DataGroup::scalars | ( | ) |
Return the scalar data structure.
const NamedData< DataGroup::ScalarType > & SurgSim::DataStructures::DataGroup::scalars | ( | ) | const |
Return the scalar data structure.
NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings | ( | ) |
Return the string data structure.
const NamedData< DataGroup::StringType > & SurgSim::DataStructures::DataGroup::strings | ( | ) | const |
Return the string data structure.
NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors | ( | ) |
Return the vector data structure.
const NamedData< DataGroup::VectorType > & SurgSim::DataStructures::DataGroup::vectors | ( | ) | const |
Return the vector data structure.