From 306b80c1cf9ab490a83b36d3e7cf07e09f9e5d68 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 15 May 2010 07:44:10 +0000 Subject: mkunit.sh was a little dumb, it didn't handle a number of things correctly. I've written a new program that basically does the same thing, only it's much more clever, and does many more of the translations and conversions better, including the #line directives. Also, I dropped nids, we don't need it anymore. But now I'm ready to write some serious tests for myriad. --- src/nids.h | 121 ------------------------------------------------------------- 1 file changed, 121 deletions(-) delete mode 100644 src/nids.h (limited to 'src/nids.h') diff --git a/src/nids.h b/src/nids.h deleted file mode 100644 index 0976e67..0000000 --- a/src/nids.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2007-2010 Xagasoft, All rights reserved. - * - * This file is part of the libbu++ library and is released under the - * terms of the license contained in the file LICENSE. - */ - -#ifndef BU_NIDS_H -#define BU_NIDS_H - -#include -#include "bu/bitstring.h" -#include "bu/exceptionbase.h" - -namespace Bu -{ - class Stream; - class NidsStream; - - subExceptionDecl( NidsException ) - - /** - * 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 - { - friend class NidsStream; - public: - Nids( Bu::Stream &sStore ); - virtual ~Nids(); - - /** - * Initialize this object based on the data already in the assosiated - * stream. This will be called automatically for you if you forget, - * but if you want to pre-initialize for some reason, just call this - * once before you actually start doing anything with your Nids. - */ - void initialize(); - - /** - * 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. - */ - NidsStream openStream( int iID ); - - int getBlockSize(); - int getNumBlocks(); - int getNumUsedBlocks(); - int getBlockStart(); - int getBlockOverhead(); - - /** - * Syncronize the header data, etc. with the storage stream. It's not - * a bad idea to call this periodically. - */ - void sync(); - - private: - typedef struct Block - { - uint32_t uFirstBlock; - uint32_t uNextBlock; - // uint32_t uPrevBlock; - uint32_t uBytesUsed; - // uint32_t uReserved; - unsigned char pData[0]; - } Block; - - enum - { - blockUnused = 0xFFFFFFFFUL - }; - - void initBlock( uint32_t uPos, uint32_t uFirstBlock, - /*uint32_t uPrevBlock,*/ bool bNew=false ); - uint32_t createBlock( uint32_t uFirstBlock, /*uint32_t uPrevBlock,*/ - int iPreAllocate=1 ); - void getBlock( uint32_t uIndex, Block *pBlock ); - void setBlock( uint32_t uIndex, Block *pBlock ); - void updateStreamSize( uint32_t uIndex, uint32_t uSize ); - uint32_t getNextBlock( uint32_t uIndex, Block *pBlock, - bool bCreate=true); - - void updateHeader(); - - // Block allocation routines - Block *newBlock(); - void deleteBlock( Block *pBlock ); - - private: - Bu::Stream &sStore; - int iBlockSize; - int iBlocks; - int iBlockStart; - int iUsed; - Bu::BitString bsBlockUsed; - }; -}; - -#endif -- cgit v1.2.3