SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_object_manager.h
Go to the documentation of this file.
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_object_manager.h -- Manager of objects (naming, &c.)
23 */
34 #ifndef SC_OBJECT_MANAGER_H
35 #define SC_OBJECT_MANAGER_H
36 
37 #include <map>
38 #include <vector>
39 
40 namespace sc_core {
41 
42 class sc_event;
43 class sc_object;
44 class sc_module_name;
45 
46 
54 {
55  friend class sc_event;
56  friend class sc_object;
57  friend class sc_simcontext;
58 
59 protected:
61  {
66  };
67 
68  struct table_entry
69  {
71 
72  void* m_element_p; // can be an sc_object or an sc_event
74  };
75 
76 public:
77  typedef std::map<std::string,table_entry> instance_table_t;
78  typedef std::vector<sc_object*> object_vector_t;
79 
82 
83  bool name_exists(const std::string& name);
84  const char* get_name(const std::string& name);
85 
86  sc_event* find_event(const char* name);
87 
88  sc_object* find_object(const char* name);
91 
92  void hierarchy_push(sc_object* mdl);
95  int hierarchy_size();
96 
97  void push_module_name(sc_module_name* mod_name);
100 
101 
102 private:
103  std::string create_name( const char* leaf_name );
104  void insert_event(const std::string& name, sc_event* obj);
105  void insert_object(const std::string& name, sc_object* obj);
106  bool insert_external_name(const std::string& name);
107  void remove_event(const std::string& name);
108  void remove_object(const std::string& name);
109  bool remove_external_name(const std::string& name);
110 
111 private:
112 
113  instance_table_t::iterator m_event_it; // event instance iterator.
114  bool m_event_walk_ok; // true if can walk events.
115  instance_table_t m_instance_table; // table of instances.
116  sc_module_name* m_module_name_stack; // sc_module_name stack.
117  instance_table_t::iterator m_object_it; // object instance iterator.
118  object_vector_t m_object_stack; // sc_object stack.
119  bool m_object_walk_ok; // true if can walk objects.
120 };
121 
122 } // namespace sc_core
123 
124 // $Log: sc_object_manager.h,v $
125 // Revision 1.9 2011/08/26 20:46:10 acg
126 // Andy Goodrich: moved the modification log to the end of the file to
127 // eliminate source line number skew when check-ins are done.
128 //
129 // Revision 1.8 2011/03/06 15:55:11 acg
130 // Andy Goodrich: Changes for named events.
131 //
132 // Revision 1.7 2011/03/05 19:44:20 acg
133 // Andy Goodrich: changes for object and event naming and structures.
134 //
135 // Revision 1.6 2011/03/05 01:39:21 acg
136 // Andy Goodrich: changes for named events.
137 //
138 // Revision 1.5 2011/02/18 20:27:14 acg
139 // Andy Goodrich: Updated Copyrights.
140 //
141 // Revision 1.4 2011/02/13 21:47:37 acg
142 // Andy Goodrich: update copyright notice.
143 //
144 // Revision 1.3 2010/07/22 20:02:33 acg
145 // Andy Goodrich: bug fixes.
146 //
147 // Revision 1.2 2008/05/22 17:06:26 acg
148 // Andy Goodrich: updated copyright notice to include 2008.
149 //
150 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
151 // SystemC 2.3
152 //
153 // Revision 1.3 2006/01/13 18:44:30 acg
154 // Added $Log to record CVS changes into the source.
155 
156 #endif
sc_event * find_event(const char *name)
sc_object * find_object(const char *name)
const char * get_name(const std::string &name)
Abstract base class of all SystemC `simulation&#39; objects.
Definition: sc_object.h:61
sc_object * hierarchy_curr()
The event class.
Definition: sc_event.h:256
Module name class.
void hierarchy_push(sc_object *mdl)
sc_module_name * top_of_module_name_stack()
Manager of objects.
sc_module_name * pop_module_name()
class SC_API sc_event
Definition: sc_interface.h:40
The simulation context.
std::map< std::string, table_entry > instance_table_t
void push_module_name(sc_module_name *mod_name)
bool name_exists(const std::string &name)
std::vector< sc_object * > object_vector_t