aboutsummaryrefslogtreecommitdiff
path: root/src/myriad.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-04-12 07:37:09 +0000
committerMike Buland <eichlan@xagasoft.com>2010-04-12 07:37:09 +0000
commit41c9581b48f055f6559335ffc0316f27ed1b3657 (patch)
tree22c6737ff5e6fd7732597dcd83a190ae917f0079 /src/myriad.h
parent943cf16f5661357086532b2241e6f85bfe43565a (diff)
downloadlibbu++-41c9581b48f055f6559335ffc0316f27ed1b3657.tar.gz
libbu++-41c9581b48f055f6559335ffc0316f27ed1b3657.tar.bz2
libbu++-41c9581b48f055f6559335ffc0316f27ed1b3657.tar.xz
libbu++-41c9581b48f055f6559335ffc0316f27ed1b3657.zip
Myriad is getting pretty close, just have to finish the writing code and
probably tweak the header init.
Diffstat (limited to '')
-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};