sc_module_registry.h revision 12027:1eb7dc7aa10b
1/***************************************************************************** 2 3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 4 more contributor license agreements. See the NOTICE file distributed 5 with this work for additional information regarding copyright ownership. 6 Accellera licenses this file to you under the Apache License, Version 2.0 7 (the "License"); you may not use this file except in compliance with the 8 License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 15 implied. See the License for the specific language governing 16 permissions and limitations under the License. 17 18 *****************************************************************************/ 19 20/***************************************************************************** 21 22 sc_module_registry.h -- Registry for all modules. 23 FOR INTERNAL USE ONLY. 24 25 Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21 26 27 CHANGE LOG AT THE END OF THE FILE 28 *****************************************************************************/ 29 30 31#ifndef SC_MODULE_REGISTRY_H 32#define SC_MODULE_REGISTRY_H 33 34 35namespace sc_core { 36 37class sc_module; 38class sc_simcontext; 39 40 41// ---------------------------------------------------------------------------- 42// CLASS : sc_module_registry 43// 44// Registry for all modules. 45// FOR INTERNAL USE ONLY! 46// ---------------------------------------------------------------------------- 47 48class sc_module_registry 49{ 50 friend class sc_simcontext; 51 52public: 53 54 void insert( sc_module& ); 55 void remove( sc_module& ); 56 57 int size() const 58 { return m_module_vec.size(); } 59 60private: 61 62 // constructor 63 explicit sc_module_registry( sc_simcontext& simc_ ); 64 65 // destructor 66 ~sc_module_registry(); 67 68 // called when construction is done 69 bool construction_done(); 70 71 // called when elaboration is done 72 void elaboration_done(); 73 74 // called before simulation begins 75 void start_simulation(); 76 77 // called after simulation ends 78 void simulation_done(); 79 80 81private: 82 83 int m_construction_done; 84 std::vector<sc_module*> m_module_vec; 85 sc_simcontext* m_simc; 86 87private: 88 89 // disabled 90 sc_module_registry(); 91 sc_module_registry( const sc_module_registry& ); 92 sc_module_registry& operator = ( const sc_module_registry& ); 93}; 94 95} // namespace sc_core 96 97#endif 98 99// $Log: sc_module_registry.h,v $ 100// Revision 1.6 2011/08/26 20:46:10 acg 101// Andy Goodrich: moved the modification log to the end of the file to 102// eliminate source line number skew when check-ins are done. 103// 104// Revision 1.5 2011/05/09 04:07:49 acg 105// Philipp A. Hartmann: 106// (1) Restore hierarchy in all phase callbacks. 107// (2) Ensure calls to before_end_of_elaboration. 108// 109// Revision 1.4 2011/02/18 20:27:14 acg 110// Andy Goodrich: Updated Copyrights. 111// 112// Revision 1.3 2011/02/13 21:47:37 acg 113// Andy Goodrich: update copyright notice. 114// 115// Revision 1.2 2008/05/22 17:06:26 acg 116// Andy Goodrich: updated copyright notice to include 2008. 117// 118// Revision 1.1.1.1 2006/12/15 20:20:05 acg 119// SystemC 2.3 120// 121// Revision 1.3 2006/01/13 18:44:30 acg 122// Added $Log to record CVS changes into the source. 123 124// Taf! 125