#ifndef __FILEIO_H__
#define __FILEIO_H__
enum FileIOStatus
{
eFileIOExport_Stop,
eFileIOExport_WaitForCalibration,
eFileIOExport_Start,
eFileIOImport_Loading,
eFileIOImport_WaitForCalibration,
eFileIOImport_Start,
eFileIOImport_Pause,
};
bool FileExist( const char* pFileName );
typedef FBArrayTemplate<FBMocapJointsState*> MocapJointsStateArray;
class FileIO
{
public:
FileIO();
~FileIO();
bool Export(FBMocapJointsState* pKinectMocapJointsState);
void Close();
bool FetchMocapData( FBMocapJointsState* pKinectMocapJointsState );
FileIOStatus GetStatus();
void SetStatus( FileIOStatus pState );
private:
bool Open(bool pReadOnly = false);
inline void ClearMocapJointsStateArray();
inline void WriteTitle(const char* pS);
inline void Write(const char* pS);
inline void Write(const int& pNumber);
inline void Write(const double& pNumber);
inline void Write(const FBMatrix& pM);
bool ReadLine(char* pBuffer, double* pData, int pLength);
inline bool ReadVector(
char* pBuffer,
FBTVector& pV);
inline bool ReadInt(char* pBuffer, int& pNumber);
inline bool ReadDouble(char* pBuffer, double& pNumber);
inline bool ReadMatrix(char* pBuffer, FBMatrix& pM);
bool StringToDouble(const char* pString, double& pNumber);
bool LoadEmptyFrame();
bool LoadValidFrame();
private:
FileIOStatus mStatus;
const char* mFilePath;
MocapJointsStateArray mMocapJointsStateArray;
int mCurrentIndex;
};
#endif