pinapa-class-inst-deco.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * arch-tag: Matthieu MOY, Wed May 26 17:35:27 2004 (scp-class-inst-deco.h)
00003  *------------------------------------------------------------------------------
00004  *         Copyright (c) STMicroelectronics,Verimag
00005  * Pinapa is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00018  * MA 02111-1307, USA
00019  *------------------------------------------------------------------------------
00020  *                 System Platform Group - HPC
00021  *******************************************************************************/
00022 
00030 #include "pinapa-parser-all.h"
00031 
00032 #ifndef PINAPA_CLASS_INST_DECO_H
00033 #define PINAPA_CLASS_INST_DECO_H
00034 
00035 #include <ext/hash_map>
00036 
00037 #include "pinapa-tree.h"
00038 #include "pinapa-systemc-light.h"
00039 #include "pinapa-decoration-base.h"
00040 
00041 namespace pinapa {
00042   
00043   struct hash_key_assoc_tree_module;
00044   struct equal_to_key_assoc_tree_module;
00045 
00051   class key_assoc_tree_module {
00052     friend class equal_to_key_assoc_tree_module;
00053     friend class hash_key_assoc_tree_module;
00054   public:
00055     key_assoc_tree_module(const tree t, sc_module * const m)
00056       : m_tree(t), m_module(m) {}
00057 
00058     key_assoc_tree_module(const key_assoc_tree_module& k)
00059       : m_tree(k.m_tree), m_module(k.m_module) {}
00060 
00061     tree m_tree;
00062     sc_module * m_module;
00063     
00064   };
00065   
00070   struct equal_to_key_assoc_tree_module {
00071     bool operator()(const key_assoc_tree_module k1,
00072                     const key_assoc_tree_module k2) const {
00073       return (k1.m_tree   == k2.m_tree)
00074         and  (k1.m_module == k2.m_module);
00075     }
00076   };
00077   
00078   struct hash_key_assoc_tree_module {
00079     size_t operator () (const key_assoc_tree_module k) const {
00080       hash<int> H;
00081       // Hashing on pointer value.
00082       return H((int)k.m_tree + (int)k.m_module);
00083     }
00084   };
00087   template<>
00088   void * get_decoration<key_assoc_tree_module>
00089   (key_assoc_tree_module & th);
00090 
00091   template<>
00092   void set_decoration<key_assoc_tree_module>
00093   (key_assoc_tree_module & th, void * d);
00094 
00095   class st_tree_instance_module_deco_t {
00096     //
00097   };
00098 
00099   typedef st_deco_first<st_tree_instance_module_deco_t,
00100                         key_assoc_tree_module> st_tree_instance_module_deco;
00101 
00102   typedef st_tree_instance_module_deco * tree_instance_module_deco;
00103 
00104   typedef hash_map<key_assoc_tree_module,
00105                    tree_instance_module_deco,
00106                    hash_key_assoc_tree_module,
00107                    equal_to_key_assoc_tree_module > assoc_tree_module;
00108   extern assoc_tree_module instances_module_deco;
00109 
00110 }
00111 
00112 #endif // PINAPA_CLASS_INST_DECO_H
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page