SystemC  Recoding Infrastructure for SystemC v0.6.0 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_object_manager.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_object_manager.h -- Manager of objects (naming, &c.)
21 
22  Original Author: Stan Y. Liao, Synopsys, Inc.
23 
24  CHANGE LOG AT THE END OF THE FILE
25  *****************************************************************************/
26 
27 
28 #ifndef SC_OBJECT_MANAGER_H
29 #define SC_OBJECT_MANAGER_H
30 
31 #include <map>
32 #include <vector>
33 
34 namespace sc_core {
35 
36 class sc_event;
37 class sc_object;
38 class sc_module_name;
39 
40 
41 // ----------------------------------------------------------------------------
42 // CLASS : sc_object_manager
43 //
44 // Manager of objects.
45 // ----------------------------------------------------------------------------
46 
48 {
49  friend class sc_event;
50  friend class sc_object;
51  friend class sc_simcontext;
52 
53 protected:
54  struct table_entry
55  {
56  table_entry() : m_event_p(NULL), m_object_p(NULL) {}
57 
58  sc_event* m_event_p; // if non-null this is an sc_event.
59  sc_object* m_object_p; // if non-null this is an sc_object.
60  };
61 
62 public:
63  typedef std::map<std::string,table_entry> instance_table_t;
64  typedef std::vector<sc_object*> object_vector_t;
65 
68 
69  sc_event* find_event(const char* name);
70 
71  sc_object* find_object(const char* name);
74 
75  void hierarchy_push(sc_object* mdl);
78  int hierarchy_size();
79 
80  void push_module_name(sc_module_name* mod_name);
83 
84 
85 private:
86  std::string create_name( const char* leaf_name );
87  void insert_event(const std::string& name, sc_event* obj);
88  void insert_object(const std::string& name, sc_object* obj);
89  void remove_event(const std::string& name);
90  void remove_object(const std::string& name);
91 
92 private:
93 
94  instance_table_t::iterator m_event_it; // event instance iterator.
95  bool m_event_walk_ok; // true if can walk events.
96  instance_table_t m_instance_table; // table of instances.
97  sc_module_name* m_module_name_stack; // sc_module_name stack.
98  instance_table_t::iterator m_object_it; // object instance iterator.
99  object_vector_t m_object_stack; // sc_object stack.
100  bool m_object_walk_ok; // true if can walk objects.
101 };
102 
103 } // namespace sc_core
104 
105 // $Log: sc_object_manager.h,v $
106 // Revision 1.9 2011/08/26 20:46:10 acg
107 // Andy Goodrich: moved the modification log to the end of the file to
108 // eliminate source line number skew when check-ins are done.
109 //
110 // Revision 1.8 2011/03/06 15:55:11 acg
111 // Andy Goodrich: Changes for named events.
112 //
113 // Revision 1.7 2011/03/05 19:44:20 acg
114 // Andy Goodrich: changes for object and event naming and structures.
115 //
116 // Revision 1.6 2011/03/05 01:39:21 acg
117 // Andy Goodrich: changes for named events.
118 //
119 // Revision 1.5 2011/02/18 20:27:14 acg
120 // Andy Goodrich: Updated Copyrights.
121 //
122 // Revision 1.4 2011/02/13 21:47:37 acg
123 // Andy Goodrich: update copyright notice.
124 //
125 // Revision 1.3 2010/07/22 20:02:33 acg
126 // Andy Goodrich: bug fixes.
127 //
128 // Revision 1.2 2008/05/22 17:06:26 acg
129 // Andy Goodrich: updated copyright notice to include 2008.
130 //
131 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
132 // SystemC 2.3
133 //
134 // Revision 1.3 2006/01/13 18:44:30 acg
135 // Added $Log to record CVS changes into the source.
136 
137 #endif
void push_module_name(sc_module_name *mod_name)
sc_object * find_object(const char *name)
sc_module_name * pop_module_name()
sc_object * hierarchy_curr()
Module name class.
The event class.
Definition: sc_event.h:260
void hierarchy_push(sc_object *mdl)
The simulation context.
std::map< std::string, table_entry > instance_table_t
std::vector< sc_object * > object_vector_t
sc_module_name * top_of_module_name_stack()
sc_event * find_event(const char *name)
Abstract base class of all SystemC `simulation&#39; objects.
Definition: sc_object.h:51