00001 #pragma once 00002 00004 // 00005 // 00006 // Programmed by Chanwoo Kim 00007 // 00008 // How to use 00009 // 00010 // 00. CFeat* pFeat 00011 // 00012 // 01. pFeat->Init.... 00013 // 00014 // 02. pFeat->WriteVec or pFeat->ReadVec 00015 // 00016 // ** Caution: except special cases, you don't need to call WriteHeader or CloseFile 00017 // 00018 00019 #include <cstdio> 00020 #include <vector> 00021 00022 #include "fe.h" 00023 #include "libutil.h" 00024 00025 class CFeature 00026 { 00027 FILE* m_pFeatFile; 00028 00029 int32 GetFileSize(const char* pszFeatFile); 00030 int32 m_iByteSwap; 00031 00032 public: 00033 00034 enum FEAT_MODE 00035 { 00036 FEAT_READ, 00037 FEAT_WRITE, 00038 } m_featMode; 00039 00040 const char* m_pszFeatFile; 00041 int m_iDim; 00042 int m_iNumVec; 00043 00044 CFeature(); 00045 ~CFeature(); 00046 00047 int32 Init(const char* pszFeatFile, int iDim, FEAT_MODE featMode = FEAT_READ); 00048 int32 WriteVec(float32* pfVec); 00049 00050 00051 int32 ReadVec(float32* pf_x, int32 i_x_Len); 00052 int32 WriteHeader(void); 00053 int32 CloseFile(void); 00054 };