aboutsummaryrefslogtreecommitdiff
path: root/src/myriad.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/myriad.h')
-rw-r--r--src/myriad.h41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/myriad.h b/src/myriad.h
index f6d5e51..0344057 100644
--- a/src/myriad.h
+++ b/src/myriad.h
@@ -30,7 +30,7 @@ namespace Bu
30 * Header format is as follows: 30 * Header format is as follows:
31 * 31 *
32 * MMMMvBssssSSSS* 32 * MMMMvBssssSSSS*
33 * M = Magic number 33 * M = Magic number (FFC399BD)
34 * v = version number 34 * v = version number
35 * B = Bits per int 35 * B = Bits per int
36 * s = Blocksize in bytes 36 * s = Blocksize in bytes
@@ -95,12 +95,12 @@ namespace Bu
95 /** 95 /**
96 * Delete a stream that's already within the Myriad. 96 * Delete a stream that's already within the Myriad.
97 */ 97 */
98 void deleteStream( int iID ); 98 void deleteStream( int iId );
99 99
100 /** 100 /**
101 * Return a new Stream object assosiated with the given stream ID. 101 * Return a new Stream object assosiated with the given stream ID.
102 */ 102 */
103 MyriadStream openStream( int iID ); 103 MyriadStream openStream( int iId );
104 104
105 int getBlockSize(); 105 int getBlockSize();
106 int getNumBlocks(); 106 int getNumBlocks();
@@ -118,25 +118,42 @@ namespace Bu
118 { 118 {
119 blockUnused = 0xFFFFFFFFUL 119 blockUnused = 0xFFFFFFFFUL
120 }; 120 };
121
122 typedef Bu::Array<int> BlockArray;
123 class Stream
124 {
125 public:
126 int iId;
127 int iSize;
128 BlockArray aBlocks;
129 };
130 typedef Bu::Array<Stream *> StreamArray;
131
132 class Block
133 {
134 public:
135 char *pData;
136 bool bChanged;
137 int iBlockIndex;
138 };
121 139
122 void updateHeader(); 140 void updateHeader();
123 int findEmptyBlock(); 141 int findEmptyBlock();
124 142
143 /**
144 *@todo Change this to use a binary search, it's nicer.
145 */
146 Stream *findStream( int iId );
147
148 Block *getBlock( int iBlock );
149 void releaseBlock( Block *pBlock );
150
125 private: 151 private:
126 Bu::Stream &sStore; 152 Bu::Stream &sStore;
127 int iBlockSize; 153 int iBlockSize;
128 int iBlocks; 154 int iBlocks;
129 int iUsed; 155 int iUsed;
130 Bu::BitString bsBlockUsed; 156 Bu::BitString bsBlockUsed;
131 typedef Bu::Array<int> BlockArray;
132 class Stream
133 {
134 public:
135 int iId;
136 int iSize;
137 BlockArray aBlocks;
138 };
139 typedef Bu::Array<Stream *> StreamArray;
140 StreamArray aStreams; 157 StreamArray aStreams;
141 }; 158 };
142}; 159};