Main Page   Class Hierarchy   Compound List   File List   Compound Members  

code.h

00001 #ifndef CMA_CODE_DEFINED
00002 #define CMA_CODE_DEFINED
00003 
00004 #include <stdlib.h>
00005 #include <vector>
00006 
00007 namespace CMa
00008 {
00014         template<class Word, class Int> class Code
00015         {
00016         public:
00017                 vector<Word> data;
00018 
00019 
00020 
00021                 /* Interfaces used by the templates */
00022 
00023                 void init()
00024                 {
00025                         // Nothing for now
00026                 }
00027 
00028                 void deInit()
00029                 {
00030                         // Nothing for now
00031                 }
00032 
00038                 inline bool verifyAddress(Int addr)
00039                 {
00040                         return verifyInterval(addr, addr);
00041                 }
00042 
00048                 inline bool verifyInterval(Int addr1, Int addr2)
00049                 {
00050                         return ((Int)0 <= addr1 && addr2 < (Int)data.size());
00051                 }
00052 
00060                 inline const Word& operator[](Int addr)
00061                 {
00062                         assert(verifyAddress(addr));
00063                         return data[addr.convertToint()];
00064                 }
00065         };
00066 }
00067 
00068 #endif
00069 

Generated on Tue Oct 12 03:30:43 1999 by doxygen1.2.18