112027Sjungma@eit.uni-kl.de/***************************************************************************** 212027Sjungma@eit.uni-kl.de 312027Sjungma@eit.uni-kl.de Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 412027Sjungma@eit.uni-kl.de more contributor license agreements. See the NOTICE file distributed 512027Sjungma@eit.uni-kl.de with this work for additional information regarding copyright ownership. 612027Sjungma@eit.uni-kl.de Accellera licenses this file to you under the Apache License, Version 2.0 712027Sjungma@eit.uni-kl.de (the "License"); you may not use this file except in compliance with the 812027Sjungma@eit.uni-kl.de License. You may obtain a copy of the License at 912027Sjungma@eit.uni-kl.de 1012027Sjungma@eit.uni-kl.de http://www.apache.org/licenses/LICENSE-2.0 1112027Sjungma@eit.uni-kl.de 1212027Sjungma@eit.uni-kl.de Unless required by applicable law or agreed to in writing, software 1312027Sjungma@eit.uni-kl.de distributed under the License is distributed on an "AS IS" BASIS, 1412027Sjungma@eit.uni-kl.de WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 1512027Sjungma@eit.uni-kl.de implied. See the License for the specific language governing 1612027Sjungma@eit.uni-kl.de permissions and limitations under the License. 1712027Sjungma@eit.uni-kl.de 1812027Sjungma@eit.uni-kl.de *****************************************************************************/ 1912027Sjungma@eit.uni-kl.de 2012027Sjungma@eit.uni-kl.de/***************************************************************************** 2112027Sjungma@eit.uni-kl.de 2212027Sjungma@eit.uni-kl.de sc_object_manager.h -- Manager of objects (naming, &c.) 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de Original Author: Stan Y. Liao, Synopsys, Inc. 2512027Sjungma@eit.uni-kl.de 2612027Sjungma@eit.uni-kl.de CHANGE LOG AT THE END OF THE FILE 2712027Sjungma@eit.uni-kl.de *****************************************************************************/ 2812027Sjungma@eit.uni-kl.de 2912027Sjungma@eit.uni-kl.de 3012027Sjungma@eit.uni-kl.de#ifndef SC_OBJECT_MANAGER_H 3112027Sjungma@eit.uni-kl.de#define SC_OBJECT_MANAGER_H 3212027Sjungma@eit.uni-kl.de 3312027Sjungma@eit.uni-kl.de#include <map> 3412027Sjungma@eit.uni-kl.de#include <vector> 3512027Sjungma@eit.uni-kl.de 3612027Sjungma@eit.uni-kl.denamespace sc_core { 3712027Sjungma@eit.uni-kl.de 3812027Sjungma@eit.uni-kl.declass sc_event; 3912027Sjungma@eit.uni-kl.declass sc_object; 4012027Sjungma@eit.uni-kl.declass sc_module_name; 4112027Sjungma@eit.uni-kl.de 4212027Sjungma@eit.uni-kl.de 4312027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 4412027Sjungma@eit.uni-kl.de// CLASS : sc_object_manager 4512027Sjungma@eit.uni-kl.de// 4612027Sjungma@eit.uni-kl.de// Manager of objects. 4712027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 4812027Sjungma@eit.uni-kl.de 4912027Sjungma@eit.uni-kl.declass sc_object_manager 5012027Sjungma@eit.uni-kl.de{ 5112027Sjungma@eit.uni-kl.de friend class sc_event; 5212027Sjungma@eit.uni-kl.de friend class sc_object; 5312027Sjungma@eit.uni-kl.de friend class sc_simcontext; 5412027Sjungma@eit.uni-kl.de 5512027Sjungma@eit.uni-kl.deprotected: 5612027Sjungma@eit.uni-kl.de struct table_entry 5712027Sjungma@eit.uni-kl.de { 5812027Sjungma@eit.uni-kl.de table_entry() : m_event_p(NULL), m_object_p(NULL) {} 5912027Sjungma@eit.uni-kl.de 6012027Sjungma@eit.uni-kl.de sc_event* m_event_p; // if non-null this is an sc_event. 6112027Sjungma@eit.uni-kl.de sc_object* m_object_p; // if non-null this is an sc_object. 6212027Sjungma@eit.uni-kl.de }; 6312027Sjungma@eit.uni-kl.de 6412027Sjungma@eit.uni-kl.depublic: 6512027Sjungma@eit.uni-kl.de typedef std::map<std::string,table_entry> instance_table_t; 6612027Sjungma@eit.uni-kl.de typedef std::vector<sc_object*> object_vector_t; 6712027Sjungma@eit.uni-kl.de 6812027Sjungma@eit.uni-kl.de sc_object_manager(); 6912027Sjungma@eit.uni-kl.de ~sc_object_manager(); 7012027Sjungma@eit.uni-kl.de 7112027Sjungma@eit.uni-kl.de sc_event* find_event(const char* name); 7212027Sjungma@eit.uni-kl.de 7312027Sjungma@eit.uni-kl.de sc_object* find_object(const char* name); 7412027Sjungma@eit.uni-kl.de sc_object* first_object(); 7512027Sjungma@eit.uni-kl.de sc_object* next_object(); 7612027Sjungma@eit.uni-kl.de 7712027Sjungma@eit.uni-kl.de void hierarchy_push(sc_object* mdl); 7812027Sjungma@eit.uni-kl.de sc_object* hierarchy_pop(); 7912027Sjungma@eit.uni-kl.de sc_object* hierarchy_curr(); 8012027Sjungma@eit.uni-kl.de int hierarchy_size(); 8112027Sjungma@eit.uni-kl.de 8212027Sjungma@eit.uni-kl.de void push_module_name(sc_module_name* mod_name); 8312027Sjungma@eit.uni-kl.de sc_module_name* pop_module_name(); 8412027Sjungma@eit.uni-kl.de sc_module_name* top_of_module_name_stack(); 8512027Sjungma@eit.uni-kl.de 8612027Sjungma@eit.uni-kl.de 8712027Sjungma@eit.uni-kl.deprivate: 8812027Sjungma@eit.uni-kl.de std::string create_name( const char* leaf_name ); 8912027Sjungma@eit.uni-kl.de void insert_event(const std::string& name, sc_event* obj); 9012027Sjungma@eit.uni-kl.de void insert_object(const std::string& name, sc_object* obj); 9112027Sjungma@eit.uni-kl.de void remove_event(const std::string& name); 9212027Sjungma@eit.uni-kl.de void remove_object(const std::string& name); 9312027Sjungma@eit.uni-kl.de 9412027Sjungma@eit.uni-kl.deprivate: 9512027Sjungma@eit.uni-kl.de 9612027Sjungma@eit.uni-kl.de instance_table_t::iterator m_event_it; // event instance iterator. 9712027Sjungma@eit.uni-kl.de bool m_event_walk_ok; // true if can walk events. 9812027Sjungma@eit.uni-kl.de instance_table_t m_instance_table; // table of instances. 9912027Sjungma@eit.uni-kl.de sc_module_name* m_module_name_stack; // sc_module_name stack. 10012027Sjungma@eit.uni-kl.de instance_table_t::iterator m_object_it; // object instance iterator. 10112027Sjungma@eit.uni-kl.de object_vector_t m_object_stack; // sc_object stack. 10212027Sjungma@eit.uni-kl.de bool m_object_walk_ok; // true if can walk objects. 10312027Sjungma@eit.uni-kl.de}; 10412027Sjungma@eit.uni-kl.de 10512027Sjungma@eit.uni-kl.de} // namespace sc_core 10612027Sjungma@eit.uni-kl.de 10712027Sjungma@eit.uni-kl.de// $Log: sc_object_manager.h,v $ 10812027Sjungma@eit.uni-kl.de// Revision 1.9 2011/08/26 20:46:10 acg 10912027Sjungma@eit.uni-kl.de// Andy Goodrich: moved the modification log to the end of the file to 11012027Sjungma@eit.uni-kl.de// eliminate source line number skew when check-ins are done. 11112027Sjungma@eit.uni-kl.de// 11212027Sjungma@eit.uni-kl.de// Revision 1.8 2011/03/06 15:55:11 acg 11312027Sjungma@eit.uni-kl.de// Andy Goodrich: Changes for named events. 11412027Sjungma@eit.uni-kl.de// 11512027Sjungma@eit.uni-kl.de// Revision 1.7 2011/03/05 19:44:20 acg 11612027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for object and event naming and structures. 11712027Sjungma@eit.uni-kl.de// 11812027Sjungma@eit.uni-kl.de// Revision 1.6 2011/03/05 01:39:21 acg 11912027Sjungma@eit.uni-kl.de// Andy Goodrich: changes for named events. 12012027Sjungma@eit.uni-kl.de// 12112027Sjungma@eit.uni-kl.de// Revision 1.5 2011/02/18 20:27:14 acg 12212027Sjungma@eit.uni-kl.de// Andy Goodrich: Updated Copyrights. 12312027Sjungma@eit.uni-kl.de// 12412027Sjungma@eit.uni-kl.de// Revision 1.4 2011/02/13 21:47:37 acg 12512027Sjungma@eit.uni-kl.de// Andy Goodrich: update copyright notice. 12612027Sjungma@eit.uni-kl.de// 12712027Sjungma@eit.uni-kl.de// Revision 1.3 2010/07/22 20:02:33 acg 12812027Sjungma@eit.uni-kl.de// Andy Goodrich: bug fixes. 12912027Sjungma@eit.uni-kl.de// 13012027Sjungma@eit.uni-kl.de// Revision 1.2 2008/05/22 17:06:26 acg 13112027Sjungma@eit.uni-kl.de// Andy Goodrich: updated copyright notice to include 2008. 13212027Sjungma@eit.uni-kl.de// 13312027Sjungma@eit.uni-kl.de// Revision 1.1.1.1 2006/12/15 20:20:05 acg 13412027Sjungma@eit.uni-kl.de// SystemC 2.3 13512027Sjungma@eit.uni-kl.de// 13612027Sjungma@eit.uni-kl.de// Revision 1.3 2006/01/13 18:44:30 acg 13712027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source. 13812027Sjungma@eit.uni-kl.de 13912027Sjungma@eit.uni-kl.de#endif 140