Commit 3725ee1d480b8e194e2f6de623ad856bfe89702e
1 parent
180d7f3a
simplify modifications to binary.h
Showing
1 changed file
with
7 additions
and
4 deletions
Show diff stats
envi/binary.h
... | ... | @@ -28,6 +28,7 @@ protected: |
28 | 28 | } |
29 | 29 | |
30 | 30 | //returns the file size |
31 | + // reads the file size from disk and returns it (in bytes) | |
31 | 32 | unsigned int get_file_size(){ |
32 | 33 | |
33 | 34 | struct stat results; |
... | ... | @@ -36,6 +37,8 @@ protected: |
36 | 37 | else return 0; |
37 | 38 | } |
38 | 39 | |
40 | + //make sure that the specified file size matches the file size on disk | |
41 | + // returns true/false | |
39 | 42 | bool test_file_size(){ |
40 | 43 | unsigned int sum = header; //initialize the sum (in bytes) to the header size |
41 | 44 | for(unsigned int i = 0; i<D; i++) //iterate over each dimension, summing the byte size |
... | ... | @@ -45,6 +48,7 @@ protected: |
45 | 48 | |
46 | 49 | } |
47 | 50 | |
51 | + //open the file specified in "name" for binary reading and writing | |
48 | 52 | bool open_file(std::string filename){ |
49 | 53 | //open the file as binary for reading and writing |
50 | 54 | file.open(filename.c_str(), std::ios::in | std::ios::out | std::ios::binary); |
... | ... | @@ -61,6 +65,7 @@ protected: |
61 | 65 | |
62 | 66 | public: |
63 | 67 | |
68 | + //open a file, given the file name, resolution (as a vector) and header size | |
64 | 69 | bool open(std::string filename, vec<unsigned int, D> r, unsigned int h = 0){ |
65 | 70 | if(!open_file(filename)) return false; |
66 | 71 | |
... | ... | @@ -72,19 +77,17 @@ public: |
72 | 77 | return test_file_size(); |
73 | 78 | } |
74 | 79 | |
75 | - bool open(std::string filename, unsigned int X, unsigned int h = 0){ | |
80 | + /*bool open(std::string filename, unsigned int X, unsigned int h = 0){ | |
76 | 81 | return open(filename, vec<unsigned int, 1>(X), h); |
77 | 82 | } |
78 | 83 | |
79 | 84 | bool open(std::string filename, unsigned int X, unsigned int Y, unsigned int h = 0){ |
80 | 85 | return open(filename, vec<unsigned int, 2>(X, Y), h); |
81 | - | |
82 | - | |
83 | 86 | } |
84 | 87 | |
85 | 88 | bool open(std::string filename, unsigned int X, unsigned int Y, unsigned int Z, unsigned int h = 0){ |
86 | 89 | return open(filename, vec<unsigned int, 3>(X, Y, Z), h); |
87 | - } | |
90 | + }*/ | |
88 | 91 | |
89 | 92 | }; |
90 | 93 | ... | ... |