SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_object_int.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_int.h -- For inline definitions of some utility functions.
23 DO NOT EXPORT THIS INCLUDE FILE.
24
25 Original Author: Philipp A. Hartmann, OFFIS, 2013-02-10
26
27 *****************************************************************************/
28
29#ifndef SC_OBJECT_INT_H_INCLUDED_
30#define SC_OBJECT_INT_H_INCLUDED_
31
35
36namespace sc_core {
37
38inline
40 : sc_object()
41 , m_child_events()
42 , m_child_objects()
43 , m_name_gen_p()
44{}
45
46inline
48 : sc_object(nm)
49 , m_child_events()
50 , m_child_objects()
51 , m_name_gen_p()
52{}
53
54// -----------------------------------------------------------------------
55
56inline
57sc_hierarchy_scope::sc_hierarchy_scope( kernel_tag, sc_object* obj )
58 : m_simc( (obj) ? obj->simcontext() : sc_get_curr_simcontext() )
59 , m_scoped_top()
60{
61 if( obj == m_simc->hierarchy_curr() ) {
62 m_simc = NULL;
63 return; // scope already matches
64 }
65
66 if( obj == NULL ) { // new root scope
67 m_simc->hierarchy_push(NULL);
68 return;
69 }
70
71 m_scoped_top = dynamic_cast<sc_object_host*>(obj);
72 if( m_scoped_top == NULL )
73 m_scoped_top = static_cast<sc_object_host*>(obj->get_parent_object());
74 m_simc->hierarchy_push(m_scoped_top);
75}
76
77inline
78sc_hierarchy_scope::sc_hierarchy_scope( kernel_tag, sc_object_host* objh )
79 : m_simc( (objh) ? objh->simcontext() : sc_get_curr_simcontext() )
80 , m_scoped_top(objh)
81{
82 if( objh == m_simc->hierarchy_curr() ) {
83 m_simc = NULL;
84 return; // scope already matches
85 }
86
87 m_simc->hierarchy_push(m_scoped_top);
88}
89
90} // namespace sc_core
91
92#endif // SC_OBJECT_INT_H_INCLUDED_
93// Taf!
sc_simcontext * sc_get_curr_simcontext()
class SC_API sc_object_host
Definition: sc_object.h:47
sc_object * get_parent_object() const
Definition: sc_object.h:255