move function from OMFormat.hh to typename.hh
This commit is contained in:
@@ -54,7 +54,6 @@
|
|||||||
#include <OpenMesh/Core/Utils/GenProg.hh>
|
#include <OpenMesh/Core/Utils/GenProg.hh>
|
||||||
#include <OpenMesh/Core/Utils/Endian.hh>
|
#include <OpenMesh/Core/Utils/Endian.hh>
|
||||||
#include <OpenMesh/Core/Utils/vector_traits.hh>
|
#include <OpenMesh/Core/Utils/vector_traits.hh>
|
||||||
#include <OpenMesh/Core/Mesh/Handles.hh>
|
|
||||||
// --------------------
|
// --------------------
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if defined(OM_CC_GCC) && (OM_GCC_VERSION < 30000)
|
#if defined(OM_CC_GCC) && (OM_GCC_VERSION < 30000)
|
||||||
@@ -279,30 +278,6 @@ namespace OMFormat {
|
|||||||
}; // Chunk
|
}; // Chunk
|
||||||
|
|
||||||
// ------------------------------------------------------------ Helper
|
// ------------------------------------------------------------ Helper
|
||||||
//----------------------get string for type recognition
|
|
||||||
|
|
||||||
template <typename T> std::string get_type_string(){ return "unknown";}
|
|
||||||
|
|
||||||
template <> inline std::string get_type_string<OpenMesh::FaceHandle>(){ return "facehandle";}
|
|
||||||
template <> inline std::string get_type_string<OpenMesh::EdgeHandle>(){ return "edgehandle";}
|
|
||||||
template <> inline std::string get_type_string<OpenMesh::HalfedgeHandle>(){ return "halfedgehandle";}
|
|
||||||
template <> inline std::string get_type_string<OpenMesh::VertexHandle>(){ return "vertexhandle";}
|
|
||||||
|
|
||||||
template <> inline std::string get_type_string<bool>(){ return "bool";}
|
|
||||||
template <> inline std::string get_type_string<char>(){ return "char";}
|
|
||||||
template <> inline std::string get_type_string<double>(){ return "double";}
|
|
||||||
template <> inline std::string get_type_string<float>(){ return "float";}
|
|
||||||
template <> inline std::string get_type_string<int>(){ return "int";}
|
|
||||||
template <> inline std::string get_type_string<unsigned char>(){ return "uchar";}
|
|
||||||
template <> inline std::string get_type_string<unsigned int>(){ return "uint";}
|
|
||||||
template <> inline std::string get_type_string<unsigned short>(){ return "ushort";}
|
|
||||||
|
|
||||||
template <typename T> std::string get_type_string(std::vector<T>)
|
|
||||||
{ return "std::vector of " + get_type_string(T());}
|
|
||||||
|
|
||||||
template <typename T, int Dim> std::string get_type_string(OpenMesh::VectorT<T, Dim>)
|
|
||||||
{ return "OM vector of dimension " + std::to_string(Dim) + " of type " + get_type_string(T()); }
|
|
||||||
|
|
||||||
// -------------------- get size information
|
// -------------------- get size information
|
||||||
|
|
||||||
/// Return size of header in bytes.
|
/// Return size of header in bytes.
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
#include <vector>
|
||||||
|
#include <OpenMesh/Core/Mesh/Handles.hh>
|
||||||
|
|
||||||
namespace OpenMesh {
|
namespace OpenMesh {
|
||||||
|
|
||||||
@@ -23,4 +25,28 @@ std::string get_type_name()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------get string for type recognition-- can be used in file format
|
||||||
|
|
||||||
|
inline std::string get_string_for_type(OpenMesh::FaceHandle){ return "facehandle";}
|
||||||
|
inline std::string get_string_for_type(OpenMesh::EdgeHandle){ return "edgehandle";}
|
||||||
|
|
||||||
|
inline std::string get_string_for_type(OpenMesh::HalfedgeHandle){ return "halfedgehandle";}
|
||||||
|
inline std::string get_string_for_type(OpenMesh::VertexHandle){ return "vertexhandle";}
|
||||||
|
|
||||||
|
inline std::string get_string_for_type(bool){ return "bool";}
|
||||||
|
inline std::string get_string_for_type(char){ return "char";}
|
||||||
|
inline std::string get_string_for_type(double){ return "double";}
|
||||||
|
inline std::string get_string_for_type(float){ return "float";}
|
||||||
|
inline std::string get_string_for_type(int){ return "int";}
|
||||||
|
inline std::string get_string_for_type(unsigned char){ return "uchar";}
|
||||||
|
inline std::string get_string_for_type(unsigned int){ return "uint";}
|
||||||
|
inline std::string get_string_for_type(unsigned short){ return "ushort";}
|
||||||
|
|
||||||
|
template <typename T> std::string get_string_for_type(T){return "unknown";}
|
||||||
|
template <typename T> std::string get_string_for_type(std::vector<T>){ return "std::vector<" + get_string_for_type(T()) + ">";}
|
||||||
|
|
||||||
|
|
||||||
|
//template <typename T, int Dim> std::string get_string_for_type(OpenMesh::VectorT<T, Dim>)
|
||||||
|
// { return "VectorT<"+ get_string_for_type(T(),"+std::to_string(Dim)+">";}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user