address.h

Go to the documentation of this file.
00001 //    sampalib.org ESL library and tools
00002 //    Copyright (C) 2007  Thierry Grellier
00003 //
00004 //    This program is free software; you can redistribute it and/or modify
00005 //    it under the terms of the GNU General Public License version 2 as
00006 //    published by the Free Software Foundation.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //    You should have received a copy of the GNU General Public License along
00014 //    with this program; if not, write to the Free Software Foundation, Inc.,
00015 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016 //
00017 //    contact: www.sampalib.org
00018 
00019 #ifndef SAMPA_CORE_ADDRESS_H
00020 #define SAMPA_CORE_ADDRESS_H
00021 
00022 #include "sampa/core/persistence.h"
00023 
00024 namespace Sampa {
00025 
00029   typedef unsigned long  Address;
00030 
00032   Address range_to_address(int);
00033 
00034   struct AddressGeneratorInterface {
00035     virtual Address generate(int align) = 0;
00036   };
00038 
00050   class SAMPA_PERSISTENT_CLASS(AddressGenerator) {
00051   public:
00052     enum Mode { 
00053       INCREMENTAL, 
00054       RANDOM       
00055     };
00056 
00061     AddressGenerator(int burst_size, int word_size);
00062 
00066     Address generate(int align = 1) { return m_generator->generate(align); }
00067 
00071     Address operator()(int align = 1) { return m_generator->generate(align); }
00072 
00074   private:
00075     AddressGeneratorInterface* m_generator;
00076     SAMPA_PERSISTENT(AddressGenerator);
00078   };
00079 
00080 }
00081 
00082 #endif
00083 

Generated on Sat Feb 16 16:23:15 2008 for Sampa by  doxygen 1.5.3