SystemC 3.0.0
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
24 Original Author: Stan Y. Liao, Synopsys, Inc.
25
26 CHANGE LOG AT THE END OF THE FILE
27 *****************************************************************************/
28
29
30#ifndef SC_OBJECT_MANAGER_H
31#define SC_OBJECT_MANAGER_H
32
33#include <map>
34#include <vector>
35
36namespace sc_core {
37
38class sc_event;
39class sc_object;
40class sc_module_name;
41
42
43// ----------------------------------------------------------------------------
44// CLASS : sc_object_manager
45//
46// Manager of objects.
47// ----------------------------------------------------------------------------
48
50{
51 friend class sc_event;
52 friend class sc_object;
53 friend class sc_simcontext;
54
55protected:
57 {
62 };
63
65 {
67
68 void* m_element_p; // can be an sc_object or an sc_event
70 };
71
72public:
73 typedef std::map<std::string,table_entry> instance_table_t;
74 typedef std::vector<sc_object_host*> object_vector_t;
75
78
79 bool name_exists(const std::string& name);
80 const char* get_name(const std::string& name);
81
82 sc_event* find_event(const char* name);
83
84 sc_object* find_object(const char* name);
87
92
96 const char* top_of_module_name_stack_name() const;
97
98private:
99 std::string create_name( const char* leaf_name );
100 void insert_event(const std::string& name, sc_event* obj);
101 void insert_object(const std::string& name, sc_object* obj);
102 bool insert_external_name(const std::string& name);
103 void remove_event(const std::string& name);
104 void remove_object(const std::string& name);
105 bool remove_external_name(const std::string& name);
106
107private:
108
109 instance_table_t::iterator m_event_it; // event instance iterator.
110 bool m_event_walk_ok; // true if can walk events.
111 instance_table_t m_instance_table; // table of instances.
112 sc_module_name* m_module_name_stack; // sc_module_name stack.
113 instance_table_t::iterator m_object_it; // object instance iterator.
114 object_vector_t m_object_stack; // sc_object stack.
115 bool m_object_walk_ok; // true if can walk objects.
116};
117
118} // namespace sc_core
119
120// $Log: sc_object_manager.h,v $
121// Revision 1.9 2011/08/26 20:46:10 acg
122// Andy Goodrich: moved the modification log to the end of the file to
123// eliminate source line number skew when check-ins are done.
124//
125// Revision 1.8 2011/03/06 15:55:11 acg
126// Andy Goodrich: Changes for named events.
127//
128// Revision 1.7 2011/03/05 19:44:20 acg
129// Andy Goodrich: changes for object and event naming and structures.
130//
131// Revision 1.6 2011/03/05 01:39:21 acg
132// Andy Goodrich: changes for named events.
133//
134// Revision 1.5 2011/02/18 20:27:14 acg
135// Andy Goodrich: Updated Copyrights.
136//
137// Revision 1.4 2011/02/13 21:47:37 acg
138// Andy Goodrich: update copyright notice.
139//
140// Revision 1.3 2010/07/22 20:02:33 acg
141// Andy Goodrich: bug fixes.
142//
143// Revision 1.2 2008/05/22 17:06:26 acg
144// Andy Goodrich: updated copyright notice to include 2008.
145//
146// Revision 1.1.1.1 2006/12/15 20:20:05 acg
147// SystemC 2.3
148//
149// Revision 1.3 2006/01/13 18:44:30 acg
150// Added $Log to record CVS changes into the source.
151
152#endif
class SC_API sc_event
Definition: sc_interface.h:36
class SC_API sc_object
Definition: sc_object.h:46
const char * get_name(const std::string &name)
const char * top_of_module_name_stack_name() const
bool name_exists(const std::string &name)
sc_module_name * pop_module_name()
sc_module_name * top_of_module_name_stack() const
sc_object * find_object(const char *name)
sc_object_host * hierarchy_pop()
void push_module_name(sc_module_name *mod_name)
std::vector< sc_object_host * > object_vector_t
sc_event * find_event(const char *name)
std::map< std::string, table_entry > instance_table_t
sc_object_host * hierarchy_curr()
void hierarchy_push(sc_object_host *mdl)