00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2005 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_object_manager.h -- Manager of objects (naming, &c.) 00021 00022 Original Author: Stan Y. Liao, Synopsys, Inc. 00023 00024 *****************************************************************************/ 00025 00026 /***************************************************************************** 00027 00028 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 00029 changes you are making here. 00030 00031 Name, Affiliation, Date: 00032 Description of Modification: 00033 00034 *****************************************************************************/ 00035 00036 #ifndef SC_OBJECT_MANAGER_H 00037 #define SC_OBJECT_MANAGER_H 00038 00039 namespace sc_core { 00040 00041 class sc_module_name; 00042 template <class K, class C> class sc_phash; 00043 template <class T> class sc_plist; 00044 template <class T> class sc_pvector; 00045 00046 00047 // ---------------------------------------------------------------------------- 00048 // CLASS : sc_object_manager 00049 // 00050 // Manager of objects. 00051 // ---------------------------------------------------------------------------- 00052 00053 class sc_object_manager 00054 { 00055 friend class sc_simcontext; 00056 00057 public: 00058 00059 typedef sc_phash<const char*, sc_object*> object_table_type; 00060 typedef sc_pvector<sc_object*> object_vector_type; 00061 typedef sc_plist<sc_object*> object_hierarchy_type; 00062 00063 sc_object_manager(); 00064 ~sc_object_manager(); 00065 00066 sc_object* find_object(const char* name); 00067 sc_object* first_object(); 00068 sc_object* next_object(); 00069 00070 void hierarchy_push(sc_object* mdl); 00071 sc_object* hierarchy_pop(); 00072 sc_object* hierarchy_curr(); 00073 int hierarchy_size(); 00074 00075 void push_module_name(sc_module_name* mod_name); 00076 sc_module_name* pop_module_name(); 00077 sc_module_name* top_of_module_name_stack(); 00078 00079 void insert_object(const char* name, sc_object* obj); 00080 void remove_object(const char* name); 00081 00082 private: 00083 00084 object_table_type* m_object_table; 00085 object_vector_type* m_ordered_object_vector; 00086 bool m_ordered_object_vector_dirty; 00087 int m_next_object_index; 00088 object_hierarchy_type* m_object_hierarchy; 00089 sc_module_name* m_module_name_stack; 00090 }; 00091 00092 } // namespace sc_core 00093 00094 #endif
1.5.1