degate  0.1.2
MemoryMapBase.h
Go to the documentation of this file.
00001 /* -*-c++-*-
00002 
00003  This file is part of the IC reverse engineering tool degate.
00004 
00005  Copyright 2008, 2009, 2010 by Martin Schobert
00006 
00007  Degate is free software: you can redistribute it and/or modify
00008  it under the terms of the GNU General Public License as published by
00009  the Free Software Foundation, either version 3 of the License, or
00010  any later version.
00011 
00012  Degate is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU General Public License for more details.
00016 
00017  You should have received a copy of the GNU General Public License
00018  along with degate. If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __MEMORYMAPBASE_H__
00023 #define __MEMORYMAPBASE_H__
00024 
00025 #include "globals.h"
00026 #include <string>
00027 
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <stdint.h>
00031 #include <unistd.h>
00032 #include <string.h>
00033 #include <time.h>
00034 #include <sys/types.h>
00035 #include <sys/mman.h>
00036 #include <fcntl.h>
00037 #include <assert.h>
00038 #include <limits.h>
00039 #include <math.h>
00040 
00041 namespace degate {
00042 
00043 template<typename T>
00044 class MemoryMapBase {
00045 
00046 protected:
00047         unsigned int width, height;
00048 
00049 public:
00050 
00051         MemoryMapBase(unsigned int width, unsigned int height);
00052         virtual ~MemoryMapBase();
00053 
00054         virtual int get_width() const { return width; }
00055         virtual int get_height() const { return height; }
00056 
00057 
00058         virtual void clear();
00059         virtual void clear_area(unsigned int min_x, unsigned int min_y,
00060                                                         unsigned int width, unsigned int height);
00061 
00062         virtual void set(unsigned int x, unsigned int y, T new_val);
00063         virtual T get(unsigned int x, unsigned int y) const;
00064 
00065 };
00066 
00067 }
00068 
00069 #endif