From 2749e0632908d8ce9743c560df24c5943344b661 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Fri, 30 Oct 2009 14:50:50 +0000 Subject: [PATCH] functions moved inside the classes to avoid linking errors --- wrap/io_trimesh/export_vmi.h | 12 +++++++----- wrap/io_trimesh/import_vmi.h | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/wrap/io_trimesh/export_vmi.h b/wrap/io_trimesh/export_vmi.h index 481ea4ba..849a404e 100644 --- a/wrap/io_trimesh/export_vmi.h +++ b/wrap/io_trimesh/export_vmi.h @@ -60,8 +60,12 @@ namespace io { template struct PlaceHolderType{ char A[N];}; - void WriteString(FILE *f,const char * in) { unsigned int l = strlen(in); fwrite(&l,4,1,f); fwrite(in,1,l,f);} - void WriteInt(FILE *f,const unsigned int i) { fwrite(&i,1,4,f);} + template + class ExporterVMI + { + + static void WriteString(FILE *f,const char * in) { unsigned int l = strlen(in); fwrite(&l,4,1,f); fwrite(in,1,l,f);} + static void WriteInt(FILE *f,const unsigned int i) { fwrite(&i,1,4,f);} /* save Ocf Vertex Components */ template @@ -210,9 +214,7 @@ namespace io { }; - template - class ExporterVMI - { + static FILE *& F(){static FILE * f; return f;} typedef typename SaveMeshType::FaceContainer FaceContainer; diff --git a/wrap/io_trimesh/import_vmi.h b/wrap/io_trimesh/import_vmi.h index 8b830932..fbe577ba 100644 --- a/wrap/io_trimesh/import_vmi.h +++ b/wrap/io_trimesh/import_vmi.h @@ -239,7 +239,11 @@ namespace io { - void ReadString(FILE * f,std::string & out){ + template + class ImporterVMI: public AttrAll + { + + static void ReadString(FILE * f,std::string & out){ unsigned int l; fread(&l,4,1,f); char * buf = new char[l+1]; fread(buf,1,l,f);buf[l]='\0'; @@ -247,10 +251,10 @@ namespace io { delete [] buf; } - void ReadInt(FILE *f, unsigned int & i){ fread(&i,1,4,f);} + static void ReadInt(FILE *f, unsigned int & i){ fread(&i,1,4,f);} - int LoadVertexOcfMask( FILE * f){ + static int LoadVertexOcfMask( FILE * f){ int mask =0; std::string s; @@ -383,7 +387,7 @@ namespace io { }; - int LoadFaceOcfMask( FILE * f){ + static int LoadFaceOcfMask( FILE * f){ int mask; std::string s; @@ -500,7 +504,7 @@ namespace io { } }; - int FaceMaskBitFromString(std::string s){ + static int FaceMaskBitFromString(std::string s){ if( s.find("Color",0) != std::string::npos ) return Mask::IOM_FACECOLOR; else if( s.find("BitFlags",0) != std::string::npos ) return Mask::IOM_FACEFLAGS; else if( s.find("VertexRef",0) != std::string::npos ) return Mask::IOM_FACEINDEX; else @@ -512,7 +516,7 @@ namespace io { if( s.find("WedgeTexCoord",0) != std::string::npos) return Mask::IOM_WEDGTEXCOORD; else return 0; } - int VertexMaskBitFromString(std::string s){ + static int VertexMaskBitFromString(std::string s){ if( s.find("Color",0) != std::string::npos ) return Mask::IOM_VERTCOLOR; else if( s.find("Coord",0) != std::string::npos ) return Mask::IOM_VERTCOORD; else if( s.find("BitFlags",0) != std::string::npos ) return Mask::IOM_VERTFLAGS; else @@ -523,9 +527,7 @@ namespace io { return 0; } - template - class ImporterVMI: public AttrAll - { + static FILE *& F(){static FILE * f; return f;} @@ -613,7 +615,7 @@ namespace io { return true; } - static bool Open(OpenMeshType &m,char * filename){ + static int Open(OpenMeshType &m,char * filename){ typedef typename OpenMeshType::VertexType VertexType; typedef typename OpenMeshType::FaceType FaceType;