37 #ifndef REPRESENTER_H_
38 #define REPRESENTER_H_
43 #include "CommonTypes.h"
64 class RepresenterTraits {
72 enum RepresenterDataType {
82 static RepresenterDataType TypeFromString(
const std::string& s) {
85 else if (s ==
"POLYGON_MESH")
87 else if (s ==
"VOLUME_MESH")
89 else if (s ==
"IMAGE")
91 else if (s ==
"VECTOR")
93 else if (s ==
"CUSTOM")
99 static std::string TypeToString(
const RepresenterDataType& type) {
106 return "POLYGON_MESH";
110 return "VOLUME_MESH";
134 typedef typename RepresenterTraits<T>::DatasetPointerType DatasetPointerType;
140 typedef typename RepresenterTraits<T>::DatasetConstPointerType DatasetConstPointerType;
143 typedef typename RepresenterTraits<T>::PointType PointType;
147 typedef typename RepresenterTraits<T>::ValueType ValueType;
149 typedef T DatasetType;
153 virtual ~Representer() {
157 virtual std::string GetName()
const = 0;
159 virtual RepresenterDataType GetType()
const = 0;
163 virtual unsigned GetDimensions()
const = 0;
166 virtual std::string GetVersion()
const = 0;
176 virtual void Load(
const H5::Group& fg) = 0;
179 virtual Representer* Clone()
const = 0;
182 virtual void Delete()
const = 0;
189 virtual void DeleteDataset(DatasetPointerType d)
const = 0;
190 virtual DatasetPointerType CloneDataset(DatasetConstPointerType d)
const = 0;
209 virtual DatasetConstPointerType GetReference()
const = 0;
214 virtual VectorType PointToVector(
const PointType& pt)
const = 0;
219 virtual VectorType SampleToSampleVector(
220 DatasetConstPointerType sample)
const = 0;
226 virtual DatasetPointerType SampleVectorToSample(
227 const VectorType& sample)
const = 0;
232 virtual ValueType PointSampleFromSample(DatasetConstPointerType sample,
233 unsigned ptid)
const = 0;
242 virtual ValueType PointSampleVectorToPointSample(
243 const VectorType& v)
const = 0;
249 virtual VectorType PointSampleToPointSampleVector(
250 const ValueType& pointSample)
const = 0;
260 virtual unsigned MapPointIdToInternalIdx(
unsigned ptId,
261 unsigned componentInd)
const {
262 return ptId * GetDimensions() + componentInd;
268 virtual unsigned GetPointIdForPoint(
const PointType& point)
const = 0;
280 virtual void Save(
const H5::Group& fg)
const = 0;