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
00022
00023 void init()
00024 {
00025
00026 }
00027
00028 void deInit()
00029 {
00030
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