sc_object_manager.h

Go to the documentation of this file.
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_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 // $Log: sc_object_manager.h,v $
00037 // Revision 1.1.1.1  2006/12/15 20:31:37  acg
00038 // SystemC 2.2
00039 //
00040 // Revision 1.3  2006/01/13 18:44:30  acg
00041 // Added $Log to record CVS changes into the source.
00042 //
00043 
00044 #ifndef SC_OBJECT_MANAGER_H
00045 #define SC_OBJECT_MANAGER_H
00046 
00047 #include "sysc/utils/sc_vector.h"
00048 
00049 namespace sc_core {
00050 
00051 class sc_module_name;
00052 template <class K, class C> class sc_phash;
00053 
00054 
00055 // ----------------------------------------------------------------------------
00056 //  CLASS : sc_object_manager
00057 //
00058 //  Manager of objects.
00059 // ----------------------------------------------------------------------------
00060 
00061 class sc_object_manager
00062 {
00063     friend class sc_simcontext;
00064 
00065 public:
00066 
00067     typedef sc_phash<const char*, sc_object*> object_table_type;
00068     typedef sc_pvector<sc_object*>            object_vector_type;
00069     typedef sc_plist<sc_object*>              object_hierarchy_type;
00070 
00071     sc_object_manager();
00072     ~sc_object_manager();
00073 
00074     sc_object* find_object(const char* name);
00075     sc_object* first_object();
00076     sc_object* next_object();
00077 
00078     void hierarchy_push(sc_object* mdl);
00079     sc_object* hierarchy_pop();
00080     sc_object* hierarchy_curr();
00081     int hierarchy_size();
00082 
00083     void push_module_name(sc_module_name* mod_name);
00084     sc_module_name* pop_module_name();
00085     sc_module_name* top_of_module_name_stack();
00086 
00087     void insert_object(const char* name, sc_object* obj);
00088     void remove_object(const char* name);
00089 
00090 private:
00091 
00092     object_table_type*     m_object_table;
00093     object_vector_type*    m_ordered_object_vector;
00094     bool                   m_ordered_object_vector_dirty;
00095     int                    m_next_object_index;
00096     object_hierarchy_type* m_object_hierarchy;
00097     sc_module_name*        m_module_name_stack;
00098 };
00099 
00100 } // namespace sc_core
00101 
00102 #endif

Generated on Wed Jan 21 15:32:09 2009 for SystemC by  doxygen 1.5.5