aboutsummaryrefslogtreecommitdiff
path: root/src/nids.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-10-01 16:46:32 +0000
committerMike Buland <eichlan@xagasoft.com>2008-10-01 16:46:32 +0000
commitd872f7e07c5367f251cf5ebb70a03916251f5306 (patch)
tree2140986825705e4b6bf35eba8dd556be772888ff /src/nids.h
parent467c255511749f018c4572017c9e0e87275524ac (diff)
downloadlibbu++-d872f7e07c5367f251cf5ebb70a03916251f5306.tar.gz
libbu++-d872f7e07c5367f251cf5ebb70a03916251f5306.tar.bz2
libbu++-d872f7e07c5367f251cf5ebb70a03916251f5306.tar.xz
libbu++-d872f7e07c5367f251cf5ebb70a03916251f5306.zip
Ok, NIDS is getting better and better, and I went ahead and cleaned up some
exception related code that's been annoying me. You should no longer have to include any exception header explicitly for normal operations, every class that has it's own exception to throw defines it in it's own headers. This may break some code that uses libbu++, but it's an easy fix, just delete the include for exceptions.h. Sometime soon I would also like to move from Bu::ExceptionBase to Bu::Exception, but that will affect a lot more code than this change did.
Diffstat (limited to 'src/nids.h')
-rw-r--r--src/nids.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/nids.h b/src/nids.h
index e364289..cdefdcb 100644
--- a/src/nids.h
+++ b/src/nids.h
@@ -3,12 +3,15 @@
3 3
4#include <stdint.h> 4#include <stdint.h>
5#include "bu/bitstring.h" 5#include "bu/bitstring.h"
6#include "bu/exceptionbase.h"
6 7
7namespace Bu 8namespace Bu
8{ 9{
9 class Stream; 10 class Stream;
10 class NidsStream; 11 class NidsStream;
11 12
13 subExceptionDecl( NidsException )
14
12 /** 15 /**
13 * Numerically Indexed Data Streams. This is a working name so I can 16 * Numerically Indexed Data Streams. This is a working name so I can
14 * actually get some code written instead of agonizing over the name. 17 * actually get some code written instead of agonizing over the name.
@@ -24,6 +27,14 @@ namespace Bu
24 virtual ~Nids(); 27 virtual ~Nids();
25 28
26 /** 29 /**
30 * Initialize this object based on the data already in the assosiated
31 * stream. This will be called automatically for you if you forget,
32 * but if you want to pre-initialize for some reason, just call this
33 * once before you actually start doing anything with your Nids.
34 */
35 void initialize();
36
37 /**
27 * Create a new Nids system in the assosiated stream. This should be 38 * Create a new Nids system in the assosiated stream. This should be
28 * used carefully, it will destroy all data already within the stream. 39 * used carefully, it will destroy all data already within the stream.
29 * More options will probably be added soon. 40 * More options will probably be added soon.
@@ -46,14 +57,16 @@ namespace Bu
46 */ 57 */
47 NidsStream openStream( int iID ); 58 NidsStream openStream( int iID );
48 59
60 int getBlockSize();
61
49 private: 62 private:
50 typedef struct Block 63 typedef struct Block
51 { 64 {
52 uint32_t iFirstBlock; 65 uint32_t uFirstBlock;
53 uint32_t iNextBlock; 66 uint32_t uNextBlock;
54 uint32_t iPrevBlock; 67 uint32_t uPrevBlock;
55 uint32_t iBytesUsed; 68 uint32_t uBytesUsed;
56 uint32_t iReserved; 69 uint32_t uReserved;
57 unsigned char pData[0]; 70 unsigned char pData[0];
58 } Block; 71 } Block;
59 72
@@ -62,9 +75,14 @@ namespace Bu
62 blockUnused = 0xFFFFFFFFUL 75 blockUnused = 0xFFFFFFFFUL
63 }; 76 };
64 77
65 void extendStream( int iID, int iBlockCount=1 ); 78 uint32_t createBlock( uint32_t uFirstBlock, uint32_t uPrevBlock,
66 void getBlock( int iIndex, struct Nids::Block *pBlock ); 79 int iPreAllocate=1 );
67 void setBlock( int iIndex, struct Nids::Block *pBlock ); 80 void getBlock( uint32_t uIndex, struct Nids::Block *pBlock );
81 void setBlock( uint32_t uIndex, struct Nids::Block *pBlock );
82 void updateStreamSize( uint32_t uIndex, uint32_t uSize );
83 uint32_t getNextBlock( uint32_t uIndex, struct Nids::Block *pBlock );
84 Block *newBlock();
85 void deleteBlock( Block *pBlock );
68 86
69 private: 87 private:
70 Bu::Stream &sStore; 88 Bu::Stream &sStore;