aboutsummaryrefslogtreecommitdiff
path: root/src/nids.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-09-15 20:03:56 +0000
committerMike Buland <eichlan@xagasoft.com>2008-09-15 20:03:56 +0000
commit597a1487c716b799428f4b4a4903e65df4c93ba9 (patch)
treec743b0d4dfc3bacbffc196589543ec4e9abf1aaf /src/nids.h
parent3c6cb7f2347aed974543f9082a0ccd297577db41 (diff)
downloadlibbu++-597a1487c716b799428f4b4a4903e65df4c93ba9.tar.gz
libbu++-597a1487c716b799428f4b4a4903e65df4c93ba9.tar.bz2
libbu++-597a1487c716b799428f4b4a4903e65df4c93ba9.tar.xz
libbu++-597a1487c716b799428f4b4a4903e65df4c93ba9.zip
Whoa! Loads of NIDS work. It actually compiles, runs, and I'm optimizing the
hell out of it. Good times, everyone. This is a major chunk for congo, and the new optimizations should be good.
Diffstat (limited to 'src/nids.h')
-rw-r--r--src/nids.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/nids.h b/src/nids.h
index 9954146..e364289 100644
--- a/src/nids.h
+++ b/src/nids.h
@@ -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
4namespace Bu 7namespace 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