| 1 | /* -*- c++ -*- |
|---|
| 2 | * |
|---|
| 3 | * SOCLIB_LGPL_HEADER_BEGIN |
|---|
| 4 | * |
|---|
| 5 | * This file is part of SoCLib, GNU LGPLv2.1. |
|---|
| 6 | * |
|---|
| 7 | * SoCLib is free software; you can redistribute it and/or modify it |
|---|
| 8 | * under the terms of the GNU Lesser General Public License as published |
|---|
| 9 | * by the Free Software Foundation; version 2.1 of the License. |
|---|
| 10 | * |
|---|
| 11 | * SoCLib is distributed in the hope that it will be useful, but |
|---|
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | * Lesser General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU Lesser General Public |
|---|
| 17 | * License along with SoCLib; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 19 | * 02110-1301 USA |
|---|
| 20 | * |
|---|
| 21 | * SOCLIB_LGPL_HEADER_END |
|---|
| 22 | * |
|---|
| 23 | * Copyright (c) UPMC, Lip6, SoC |
|---|
| 24 | * Mohamed Lamine Karaoui <Mohamed.Karaoui@lip6.fr>, 2012 |
|---|
| 25 | * |
|---|
| 26 | */ |
|---|
| 27 | #ifndef SOCLIB_PSEG_HANDLER_H_ |
|---|
| 28 | #define SOCLIB_PSEG_HANDLER_H_ |
|---|
| 29 | |
|---|
| 30 | #include <string> |
|---|
| 31 | #include <vector> |
|---|
| 32 | #include <ios> |
|---|
| 33 | |
|---|
| 34 | #include "stdint.h" |
|---|
| 35 | #include "mapping_info.h" |
|---|
| 36 | #include "pseg.h" |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | class MeMo; |
|---|
| 40 | |
|---|
| 41 | class PSegHandler |
|---|
| 42 | { |
|---|
| 43 | friend class MeMo; |
|---|
| 44 | |
|---|
| 45 | std::vector <PSeg> m_pSegs; |
|---|
| 46 | |
|---|
| 47 | public: |
|---|
| 48 | |
|---|
| 49 | PSeg& get( size_t pos ); |
|---|
| 50 | const PSeg& getByAddr( uintptr_t segAddress ) const ; |
|---|
| 51 | |
|---|
| 52 | //do some checking on all the Psegs. Called once the m_psegs is build. |
|---|
| 53 | void check() const; |
|---|
| 54 | |
|---|
| 55 | void print( std::ostream &o ) const; |
|---|
| 56 | |
|---|
| 57 | friend std::ostream &operator<<( std::ostream &o, const PSegHandler &s ) |
|---|
| 58 | { |
|---|
| 59 | s.print(o); |
|---|
| 60 | return o; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | PSegHandler(); |
|---|
| 64 | ~PSegHandler(); |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | #endif /* SOCLIB_PSEG_HANDLER_H_ */ |
|---|