DataGroupBuilder.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2012-2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DATASTRUCTURES_DATAGROUPBUILDER_H
#define SURGSIM_DATASTRUCTURES_DATAGROUPBUILDER_H
#include "SurgSim/DataStructures/NamedDataBuilder.h"
#include "SurgSim/DataStructures/NamedVariantData.h"
#include "SurgSim/DataStructures/DataGroup.h"
#include <Eigen/Core>
namespace SurgSim
{
namespace DataStructures
{
class DataGroupBuilder
{
public:
typedef DataGroup::PoseType PoseType;
typedef DataGroup::VectorType VectorType;
typedef DataGroup::DynamicMatrixType DynamicMatrixType;
typedef DataGroup::ScalarType ScalarType;
typedef DataGroup::IntegerType IntegerType;
typedef DataGroup::BooleanType BooleanType;
typedef DataGroup::StringType StringType;
typedef Image<float> ImageType;
DataGroupBuilder();
DataGroup createData() const;
std::shared_ptr<DataGroup> createSharedData() const;
NamedDataBuilder<PoseType>& poses();
const NamedDataBuilder<PoseType>& poses() const;
NamedDataBuilder<VectorType>& vectors();
const NamedDataBuilder<VectorType>& vectors() const;
NamedDataBuilder<DynamicMatrixType>& matrices();
const NamedDataBuilder<DynamicMatrixType>& matrices() const;
NamedDataBuilder<ScalarType>& scalars();
const NamedDataBuilder<ScalarType>& scalars() const;
NamedDataBuilder<IntegerType>& integers();
const NamedDataBuilder<IntegerType>& integers() const;
NamedDataBuilder<BooleanType>& booleans();
const NamedDataBuilder<BooleanType>& booleans() const;
NamedDataBuilder<StringType>& strings();
const NamedDataBuilder<StringType>& strings() const;
NamedDataBuilder<ImageType>& images();
const NamedDataBuilder<ImageType>& images() const;
NamedVariantDataBuilder& customData();
const NamedVariantDataBuilder& customData() const;
void addPose(const std::string& name);
void addVector(const std::string& name);
void addMatrix(const std::string& name);
void addScalar(const std::string& name);
void addInteger(const std::string& name);
void addBoolean(const std::string& name);
void addString(const std::string& name);
void addImage(const std::string& name);
void addCustom(const std::string& name);
void addEntriesFrom(const DataGroupBuilder& builder);
void addEntriesFrom(const DataGroup& data);
private:
// Prevent copy construction and copy assignment.
DataGroupBuilder(const DataGroupBuilder&);
DataGroupBuilder& operator=(const DataGroupBuilder&);
NamedDataBuilder<PoseType> m_poses;
NamedDataBuilder<VectorType> m_vectors;
NamedDataBuilder<DynamicMatrixType> m_matrices;
NamedDataBuilder<ScalarType> m_scalars;
NamedDataBuilder<IntegerType> m_integers;
NamedDataBuilder<BooleanType> m_booleans;
NamedDataBuilder<StringType> m_strings;
NamedDataBuilder<ImageType> m_images;
NamedVariantDataBuilder m_customData;
};
}; // namespace Input
}; // namespace SurgSim
#endif // SURGSIM_DATASTRUCTURES_DATAGROUPBUILDER_H
SurgSim::DataStructures::DataGroupBuilder::addPose
void addPose(const std::string &name)
A shortcut for adding a named pose entry.
Definition: DataGroupBuilder.cpp:138
SurgSim::DataStructures::DataGroupBuilder::addString
void addString(const std::string &name)
A shortcut for adding a named string entry.
Definition: DataGroupBuilder.cpp:168
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::DataStructures::DataGroupBuilder::matrices
NamedDataBuilder< DynamicMatrixType > & matrices()
Provides access to the matrix value entries.
Definition: DataGroupBuilder.cpp:68
SurgSim::DataStructures::DataGroupBuilder::m_customData
NamedVariantDataBuilder m_customData
The subsidiary builder used for custom data.
Definition: DataGroupBuilder.h:217
SurgSim::DataStructures::DataGroupBuilder::DataGroupBuilder
DataGroupBuilder()
Constructs an empty builder object.
Definition: DataGroupBuilder.cpp:24
SurgSim::DataStructures::Image
A templated Image class.
Definition: Image.h:33
SurgSim::DataStructures::DataGroupBuilder::addMatrix
void addMatrix(const std::string &name)
A shortcut for adding a named matrix entry.
Definition: DataGroupBuilder.cpp:148
DataGroup.h
SurgSim::DataStructures::DataGroupBuilder::m_scalars
NamedDataBuilder< ScalarType > m_scalars
The subsidiary builder used for scalar values.
Definition: DataGroupBuilder.h:202
SurgSim::DataStructures::DataGroupBuilder::addInteger
void addInteger(const std::string &name)
A shortcut for adding a named integer entry.
Definition: DataGroupBuilder.cpp:158
SurgSim::DataStructures::DataGroupBuilder::m_strings
NamedDataBuilder< StringType > m_strings
The subsidiary builder used for string values.
Definition: DataGroupBuilder.h:211
SurgSim::DataStructures::DataGroupBuilder::m_poses
NamedDataBuilder< PoseType > m_poses
The subsidiary builder used for pose values.
Definition: DataGroupBuilder.h:193
SurgSim::DataStructures::DataGroupBuilder::images
NamedDataBuilder< ImageType > & images()
Provides access to the image value entries.
Definition: DataGroupBuilder.cpp:118
SurgSim::DataStructures::DataGroupBuilder::m_vectors
NamedDataBuilder< VectorType > m_vectors
The subsidiary builder used for vector values.
Definition: DataGroupBuilder.h:196
SurgSim::DataStructures::DataGroup::PoseType
SurgSim::Math::RigidTransform3d PoseType
The type used for poses.
Definition: DataGroup.h:72
SurgSim::DataStructures::DataGroup::ScalarType
double ScalarType
The type used for scalars.
Definition: DataGroup.h:78
SurgSim::DataStructures::DataGroup::VectorType
SurgSim::Math::Vector3d VectorType
The type used for vectors.
Definition: DataGroup.h:74
SurgSim::DataStructures::DataGroupBuilder::m_matrices
NamedDataBuilder< DynamicMatrixType > m_matrices
The subsidiary builder used for matrix values.
Definition: DataGroupBuilder.h:199
SurgSim::DataStructures::DataGroupBuilder::StringType
DataGroup::StringType StringType
The type used for strings.
Definition: DataGroupBuilder.h:54
SurgSim::DataStructures::DataGroupBuilder::customData
NamedVariantDataBuilder & customData()
Provides access to the custom data entries.
Definition: DataGroupBuilder.cpp:128
SurgSim::DataStructures::DataGroupBuilder::scalars
NamedDataBuilder< ScalarType > & scalars()
Provides access to the scalar value entries.
Definition: DataGroupBuilder.cpp:78
SurgSim::DataStructures::NamedDataBuilder< PoseType >
SurgSim::DataStructures::DataGroupBuilder::VectorType
DataGroup::VectorType VectorType
The type used for vectors.
Definition: DataGroupBuilder.h:44
SurgSim::DataStructures::DataGroupBuilder::IntegerType
DataGroup::IntegerType IntegerType
The type used for integers.
Definition: DataGroupBuilder.h:50
SurgSim::DataStructures::DataGroupBuilder::PoseType
DataGroup::PoseType PoseType
The type used for poses.
Definition: DataGroupBuilder.h:42
SurgSim::DataStructures::DataGroupBuilder::m_images
NamedDataBuilder< ImageType > m_images
The subsidiary builder used for image values.
Definition: DataGroupBuilder.h:214
SurgSim::DataStructures::DataGroupBuilder::ImageType
Image< float > ImageType
The type used for images.
Definition: DataGroupBuilder.h:56
SurgSim::DataStructures::DataGroupBuilder::createData
DataGroup createData() const
Produces a DataGroup object with an immutable set of names and indices.
Definition: DataGroupBuilder.cpp:28
SurgSim::DataStructures::DataGroupBuilder::poses
NamedDataBuilder< PoseType > & poses()
Provides access to the pose value entries.
Definition: DataGroupBuilder.cpp:48
SurgSim::DataStructures::DataGroupBuilder::strings
NamedDataBuilder< StringType > & strings()
Provides access to the string value entries.
Definition: DataGroupBuilder.cpp:108
SurgSim::DataStructures::DataGroupBuilder::addEntriesFrom
void addEntriesFrom(const DataGroupBuilder &builder)
Create new entries from another DataGroupBuilder.
Definition: DataGroupBuilder.cpp:183
SurgSim::DataStructures::DataGroupBuilder::addCustom
void addCustom(const std::string &name)
A shortcut for adding a named custom data entry.
Definition: DataGroupBuilder.cpp:178
SurgSim::DataStructures::DataGroupBuilder::addScalar
void addScalar(const std::string &name)
A shortcut for adding a named scalar entry.
Definition: DataGroupBuilder.cpp:153
SurgSim::DataStructures::DataGroupBuilder::BooleanType
DataGroup::BooleanType BooleanType
The type used for booleans.
Definition: DataGroupBuilder.h:52
SurgSim::DataStructures::DataGroupBuilder::DynamicMatrixType
DataGroup::DynamicMatrixType DynamicMatrixType
The type used for matrices.
Definition: DataGroupBuilder.h:46
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::DataStructures::DataGroupBuilder::m_booleans
NamedDataBuilder< BooleanType > m_booleans
The subsidiary builder used for boolean values.
Definition: DataGroupBuilder.h:208
SurgSim::DataStructures::DataGroupBuilder::ScalarType
DataGroup::ScalarType ScalarType
The type used for scalars.
Definition: DataGroupBuilder.h:48
SurgSim::DataStructures::DataGroupBuilder::addVector
void addVector(const std::string &name)
A shortcut for adding a named vector entry.
Definition: DataGroupBuilder.cpp:143
SurgSim::DataStructures::DataGroup::BooleanType
bool BooleanType
The type used for booleans.
Definition: DataGroup.h:82
SurgSim::DataStructures::DataGroupBuilder::booleans
NamedDataBuilder< BooleanType > & booleans()
Provides access to the Boolean value entries.
Definition: DataGroupBuilder.cpp:98
NamedVariantData.h
SurgSim::DataStructures::DataGroup::StringType
std::string StringType
The type used for strings.
Definition: DataGroup.h:84
SurgSim::DataStructures::DataGroupBuilder::m_integers
NamedDataBuilder< IntegerType > m_integers
The subsidiary builder used for integer values.
Definition: DataGroupBuilder.h:205
SurgSim::DataStructures::DataGroupBuilder::operator=
DataGroupBuilder & operator=(const DataGroupBuilder &)
SurgSim::DataStructures::DataGroup::DynamicMatrixType
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > DynamicMatrixType
The type used for matrices.
Definition: DataGroup.h:76
SurgSim::DataStructures::DataGroupBuilder::vectors
NamedDataBuilder< VectorType > & vectors()
Provides access to the vector value entries.
Definition: DataGroupBuilder.cpp:58
SurgSim::DataStructures::DataGroupBuilder::addBoolean
void addBoolean(const std::string &name)
A shortcut for adding a named boolean entry.
Definition: DataGroupBuilder.cpp:163
SurgSim::DataStructures::DataGroupBuilder
A class that allows you to build a DataGroup structure.
Definition: DataGroupBuilder.h:38
NamedDataBuilder.h
SurgSim::DataStructures::DataGroupBuilder::createSharedData
std::shared_ptr< DataGroup > createSharedData() const
Produce a shared pointer to an empty DataGroup object with an immutable set of names and indices...
Definition: DataGroupBuilder.cpp:43
SurgSim::DataStructures::DataGroupBuilder::integers
NamedDataBuilder< IntegerType > & integers()
Provides access to the integer value entries.
Definition: DataGroupBuilder.cpp:88
SurgSim::DataStructures::DataGroup::IntegerType
int IntegerType
The type used for integers.
Definition: DataGroup.h:80
SurgSim::DataStructures::DataGroupBuilder::addImage
void addImage(const std::string &name)
A shortcut for adding a named image entry.
Definition: DataGroupBuilder.cpp:173