FaceGen 3 SDKs Reference
Loading...
Searching...
No Matches
binaryFile.hpp
1//
2// Copyright (c) Singular Inversions Inc. 2000
3//
4// Authors: Andrew Beatty
5// Created: Sept. 4, 2000
6//
7
8#ifndef FR2_BINARYFILE_HPP
9#define FR2_BINARYFILE_HPP
10
11#include "algs.hpp"
12#include "FgSerial.hpp"
13
14namespace Fg {
15
17{
18public:
19 // Constructor requires the unique file ID
20 explicit
21 FutBinaryFileC(std::string);
22
24 {close();}
25
26 void
27 changeFileId(const std::string &newFileId); // fptr must be zero.
28
29 bool
30 openForRead(String8 const &);
31
32 bool
33 openForOverwrite(String8 const &);
34
35 bool
36 writeHeader(const void *data,uint size,uint num);
37
38 bool
39 readHeader(void *data,uint size,uint num);
40
41 bool
42 write(const void *data,uint size,uint num);
43
44 bool
45 read(void *data,uint size,uint num);
46
47 bool seek(long offsetFromBeginning);
48 void close();
49 bool valid() const {return (fptr != NULL);}
50 bool operator!() const { return (fptr==NULL); }
51 bool eof();
52
53protected:
54 String8 m_fname;
55 std::string fileId;
56 FILE *fptr;
57
58 FutBinaryFileC(FutBinaryFileC&); // Copy constructor disallowed.
59 FutBinaryFileC& operator=(FutBinaryFileC&); // Operator= disallowed.
60};
61
62}
63
64#endif