DataGroupCopier.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_DATAGROUPCOPIER_H
#define SURGSIM_DATASTRUCTURES_DATAGROUPCOPIER_H
#include <array>
#include <memory>
#include <unordered_map>
#include "SurgSim/DataStructures/NamedData.h"
namespace SurgSim
{
namespace DataStructures
{
class DataGroup;
class IndexDirectory;
typedef std::array<NamedDataCopyMap, 9> DataGroupCopyMap;
class DataGroupCopier
{
public:
DataGroupCopier(const DataGroup& source, DataGroup* target);
void copy(const DataGroup& source, DataGroup* target);
private:
NamedDataCopyMap findMap(std::shared_ptr<const IndexDirectory> source,
std::shared_ptr<const IndexDirectory> target) const;
DataGroupCopyMap m_map;
};
}; // namespace DataStructures
}; // namespace SurgSim
#endif // SURGSIM_DATASTRUCTURES_DATAGROUPCOPIER_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::DataStructures::DataGroupCopyMap
std::array< NamedDataCopyMap, 9 > DataGroupCopyMap
The type used for copying values between two DataGroups that cannot assign to each other...
Definition: DataGroupCopier.h:30
SurgSim::DataStructures::DataGroupCopier::m_map
DataGroupCopyMap m_map
The map from source to target.
Definition: DataGroupCopier.h:61
NamedData.h
SurgSim::DataStructures::NamedDataCopyMap
std::unordered_map< int, int > NamedDataCopyMap
The type used for copying values between two NamedData objects that cannot assign to each other...
Definition: NamedData.h:32
SurgSim::DataStructures::DataGroupCopier::findMap
NamedDataCopyMap findMap(std::shared_ptr< const IndexDirectory > source, std::shared_ptr< const IndexDirectory > target) const
Find the entries (by name) from the source to target IndexDirectories, and return the matching entrie...
Definition: DataGroupCopier.cpp:56
SurgSim::DataStructures::IndexDirectory
A simple bidirectional mapping between names (strings) and distinct consecutive non-negative indices...
Definition: IndexDirectory.h:32
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::DataStructures::DataGroupCopier
A class that assists in copying from one DataGroup to another, when assignment is not possible...
Definition: DataGroupCopier.h:37
SurgSim::DataStructures::DataGroupCopier::copy
void copy(const DataGroup &source, DataGroup *target)
Copies the NamedData entries with the same names.
Definition: DataGroupCopier.cpp:42
SurgSim::DataStructures::DataGroupCopier::DataGroupCopier
DataGroupCopier(const DataGroup &source, DataGroup *target)
Construct a copier.
Definition: DataGroupCopier.cpp:28