diff options
Diffstat (limited to '')
-rw-r--r-- | src/nids.h | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -1,9 +1,13 @@ | |||
1 | #ifndef BU_NIDS_H | 1 | #ifndef BU_NIDS_H |
2 | #define BU_NIDS_H | 2 | #define BU_NIDS_H |
3 | 3 | ||
4 | #include <stdint.h> | ||
5 | #include "bu/bitstring.h" | ||
6 | |||
4 | namespace Bu | 7 | namespace Bu |
5 | { | 8 | { |
6 | class Stream; | 9 | class Stream; |
10 | class NidsStream; | ||
7 | 11 | ||
8 | /** | 12 | /** |
9 | * Numerically Indexed Data Streams. This is a working name so I can | 13 | * Numerically Indexed Data Streams. This is a working name so I can |
@@ -14,6 +18,7 @@ namespace Bu | |||
14 | */ | 18 | */ |
15 | class Nids | 19 | class Nids |
16 | { | 20 | { |
21 | friend class NidsStream; | ||
17 | public: | 22 | public: |
18 | Nids( Bu::Stream &sStore ); | 23 | Nids( Bu::Stream &sStore ); |
19 | virtual ~Nids(); | 24 | virtual ~Nids(); |
@@ -39,10 +44,34 @@ namespace Bu | |||
39 | /** | 44 | /** |
40 | * Return a new Stream object assosiated with the given stream ID. | 45 | * Return a new Stream object assosiated with the given stream ID. |
41 | */ | 46 | */ |
42 | Bu::Stream &openStream( int iID ); | 47 | NidsStream openStream( int iID ); |
48 | |||
49 | private: | ||
50 | typedef struct Block | ||
51 | { | ||
52 | uint32_t iFirstBlock; | ||
53 | uint32_t iNextBlock; | ||
54 | uint32_t iPrevBlock; | ||
55 | uint32_t iBytesUsed; | ||
56 | uint32_t iReserved; | ||
57 | unsigned char pData[0]; | ||
58 | } Block; | ||
59 | |||
60 | enum | ||
61 | { | ||
62 | blockUnused = 0xFFFFFFFFUL | ||
63 | }; | ||
64 | |||
65 | void extendStream( int iID, int iBlockCount=1 ); | ||
66 | void getBlock( int iIndex, struct Nids::Block *pBlock ); | ||
67 | void setBlock( int iIndex, struct Nids::Block *pBlock ); | ||
43 | 68 | ||
44 | private: | 69 | private: |
45 | Bu::Stream &sStore; | 70 | Bu::Stream &sStore; |
71 | int iBlockSize; | ||
72 | int iBlocks; | ||
73 | int iBlockStart; | ||
74 | Bu::BitString bsBlockUsed; | ||
46 | }; | 75 | }; |
47 | }; | 76 | }; |
48 | 77 | ||