Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

DCFbytepack.h

Go to the documentation of this file.
00001 // DCFbytepack.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2001-2002 Brown Deer Technology, LLC.
00004 //                        All rights reserved.
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 #ifndef DCFBYTEPACK_H
00008 #define DCFBYTEPACK_H
00009 
00010 #ifdef USE_STD
00011 #include <iostream>
00012 using namespace std;
00013 #else
00014 #include <iostream.h>
00015 #endif
00016 
00017 class bytepack {
00018    friend ostream& operator << ( ostream&, bytepack& );
00019    friend istream& operator >> ( istream&, bytepack& );
00020    public:
00021 
00022       inline bytepack( const int sizemax = 16 );
00023       inline ~bytepack();
00024       int size() { return _size; }
00025       bytepack& operator()( const char data = 0, const int size = 0 );
00026       bytepack& operator()( const int data = 0, const int size = 0 );
00027       bytepack& operator()( const float data = 0, const int size = 0 );
00028       bytepack& operator()( const double data = 0, const int size = 0 );
00029       char& operator[]( const int i ) { return _pt[i]; }
00030       char* c_str() { return _pt; }
00031       operator char();
00032       operator int();
00033       operator float();
00034       operator double();
00035    private:
00036       char* _pt;
00037       int _sizemax;
00038       int _size;
00039 };
00040 
00041 inline
00042 bytepack::bytepack( const int sizemax ) 
00043   : _sizemax(sizemax), _size(0) 
00044 {
00045    _pt = new char[ _sizemax + 1 ]; 
00046    _pt[0] = 0;
00047 }
00048 
00049 inline
00050 bytepack::~bytepack() { delete [] _pt; _pt = 0; }
00051 
00052 ostream& operator<<( ostream&, bytepack& );
00053 
00054 istream& operator>>( istream&, bytepack& );
00055 
00056 #endif
00057 

Generated on Mon May 31 21:38:43 2004 for SR2k4 Assembler by doxygen 1.3.6