00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2006 by all Contributors. 00005 All Rights reserved. 00006 00007 The contents of this file are subject to the restrictions and limitations 00008 set forth in the SystemC Open Source License Version 2.4 (the "License"); 00009 You may not use this file except in compliance with such restrictions and 00010 limitations. You may obtain instructions on how to receive a copy of the 00011 License at http://www.systemc.org/. Software distributed by Contributors 00012 under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 00013 ANY KIND, either express or implied. See the License for the specific 00014 language governing rights and limitations under the License. 00015 00016 *****************************************************************************/ 00017 00018 /***************************************************************************** 00019 00020 sc_module_registry.h -- Registry for all modules. 00021 FOR INTERNAL USE ONLY. 00022 00023 Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21 00024 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 00029 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 00030 changes you are making here. 00031 00032 Name, Affiliation, Date: Andy Goodrich, Forte 00033 Bishnupriya Bhattacharya, Cadence Design Systems, 00034 25 August, 2003 00035 Description of Modification: phase callbacks 00036 00037 *****************************************************************************/ 00038 00039 // $Log: sc_module_registry.h,v $ 00040 // Revision 1.1.1.1 2006/12/15 20:31:37 acg 00041 // SystemC 2.2 00042 // 00043 // Revision 1.3 2006/01/13 18:44:30 acg 00044 // Added $Log to record CVS changes into the source. 00045 // 00046 00047 #ifndef SC_MODULE_REGISTRY_H 00048 #define SC_MODULE_REGISTRY_H 00049 00050 00051 namespace sc_core { 00052 00053 class sc_module; 00054 class sc_simcontext; 00055 00056 00057 // ---------------------------------------------------------------------------- 00058 // CLASS : sc_module_registry 00059 // 00060 // Registry for all modules. 00061 // FOR INTERNAL USE ONLY! 00062 // ---------------------------------------------------------------------------- 00063 00064 class sc_module_registry 00065 { 00066 friend class sc_simcontext; 00067 00068 public: 00069 00070 void insert( sc_module& ); 00071 void remove( sc_module& ); 00072 00073 int size() const 00074 { return m_module_vec.size(); } 00075 00076 private: 00077 00078 // constructor 00079 explicit sc_module_registry( sc_simcontext& simc_ ); 00080 00081 // destructor 00082 ~sc_module_registry(); 00083 00084 // called when construction is done 00085 void construction_done(); 00086 00087 // called when elaboration is done 00088 void elaboration_done(); 00089 00090 // called before simulation begins 00091 void start_simulation(); 00092 00093 // called after simulation ends 00094 void simulation_done(); 00095 00096 00097 private: 00098 00099 sc_simcontext* m_simc; 00100 std::vector<sc_module*> m_module_vec; 00101 00102 private: 00103 00104 // disabled 00105 sc_module_registry(); 00106 sc_module_registry( const sc_module_registry& ); 00107 sc_module_registry& operator = ( const sc_module_registry& ); 00108 }; 00109 00110 } // namespace sc_core 00111 00112 #endif 00113 00114 // Taf!