aboutsummaryrefslogtreecommitdiff
path: root/src/nids.h
blob: 9954146d44b13a8c38d73b2beb20a843e5ce2cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef BU_NIDS_H
#define BU_NIDS_H

namespace Bu
{
	class Stream;

	/**
	 * Numerically Indexed Data Streams.  This is a working name so I can
	 * actually get some code written instead of agonizing over the name.
	 *
	 * This is a system for creating streams that contain other streams in
	 * a flexible block-allocated system.
	 */
	class Nids
	{
	public:
		Nids( Bu::Stream &sStore );
		virtual ~Nids();

		/**
		 * Create a new Nids system in the assosiated stream.  This should be
		 * used carefully, it will destroy all data already within the stream.
		 * More options will probably be added soon.
		 */
		void initialize( int iBlockSize, int iPreAllocate=1 );

		/**
		 * Create a new stream within the Nids system.  The ID of the new stream
		 * is returned.
		 */
		int createStream( int iPreAllocate=1 );

		/**
		 * Delete a stream that's already within the Nids.
		 */
		void deleteStream( int iID );

		/**
		 * Return a new Stream object assosiated with the given stream ID.
		 */
		Bu::Stream &openStream( int iID );

	private:
		Bu::Stream &sStore;
	};
};

#endif