sc_event_finder.cpp revision 12027
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_event_finder.cpp --
23
24  Original Author: Martin Janssen, Synopsys, Inc.
25                   Stan Y. Liao, Synopsys, Inc., 2001-05-21
26
27  CHANGE LOG IS AT THE END OF THE FILE
28 *****************************************************************************/
29
30#include "sysc/communication/sc_event_finder.h"
31
32namespace sc_core {
33
34// ----------------------------------------------------------------------------
35//  CLASS : sc_event_finder
36//
37//  Event finder base class.
38// ----------------------------------------------------------------------------
39
40// error reporting
41
42void
43sc_event_finder::report_error( const char* id, const char* add_msg ) const
44{
45    char msg[BUFSIZ];
46    if( add_msg != 0 ) {
47	std::sprintf( msg, "%s: port '%s' (%s)",
48		 add_msg, m_port.name(), m_port.kind() );
49    } else {
50	std::sprintf( msg, "port '%s' (%s)", m_port.name(), m_port.kind() );
51    }
52    SC_REPORT_ERROR( id, msg );
53}
54
55
56// constructor
57
58sc_event_finder::sc_event_finder( const sc_port_base& port_ )
59: m_port( port_ )
60{
61}
62
63
64// destructor (does nothing)
65
66sc_event_finder::~sc_event_finder()
67{}
68
69} // namespace sc_core
70
71// $Log: sc_event_finder.cpp,v $
72// Revision 1.3  2011/08/26 20:45:39  acg
73//  Andy Goodrich: moved the modification log to the end of the file to
74//  eliminate source line number skew when check-ins are done.
75//
76// Revision 1.2  2011/02/18 20:23:45  acg
77//  Andy Goodrich: Copyright update.
78//
79// Revision 1.1.1.1  2006/12/15 20:20:04  acg
80// SystemC 2.3
81//
82// Revision 1.7  2006/02/02 23:42:37  acg
83//  Andy Goodrich: implemented a much better fix to the sc_event_finder
84//  proliferation problem. This new version allocates only a single event
85//  finder for each port for each type of event, e.g., pos(), neg(), and
86//  value_change(). The event finder persists as long as the port does,
87//  which is what the LRM dictates. Because only a single instance is
88//  allocated for each event type per port there is not a potential
89//  explosion of storage as was true in the 2.0.1/2.1 versions.
90//
91// Revision 1.6  2006/02/02 21:26:34  acg
92//  Andy Goodrich: pulled out the check I just stuck into the
93//  sc_event_finder::free_instances() method. It turns out the LRM says that
94//  sc_event_finder instances are valid as long as the sc_module hierarchy is
95//  valid, so we can't give the user a call to free the instances.
96//
97// Revision 1.5  2006/02/02 21:10:52  acg
98//  Andy Goodrich: added check for end of elaboration to the static method
99//  sc_event_finder::free_instances(). This will allow the method to be
100//  made public if that is desired.
101//
102// Revision 1.4  2006/02/02 20:43:09  acg
103//  Andy Goodrich: Added an existence linked list to sc_event_finder so that
104//  the dynamically allocated instances can be freed after port binding
105//  completes. This replaces the individual deletions in ~sc_bind_ef, as these
106//  caused an exception if an sc_event_finder instance was used more than
107//  once, due to a double freeing of the instance.
108//
109// Revision 1.3  2006/01/13 18:47:41  acg
110// Added $Log command so that CVS comments are reproduced in the source.
111//
112
113// Taf!
114