sc_event.hh (13324:c8b709468e61) sc_event.hh (13380:6e390b3db40e)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 222 unchanged lines hidden (view full) ---

231 _method(_method)
232 {
233 _port = dynamic_cast<const sc_port_b<IF> *>(&p);
234 assert(_port);
235 }
236
237 virtual ~sc_event_finder_t() {}
238
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 222 unchanged lines hidden (view full) ---

231 _method(_method)
232 {
233 _port = dynamic_cast<const sc_port_b<IF> *>(&p);
234 assert(_port);
235 }
236
237 virtual ~sc_event_finder_t() {}
238
239 const sc_port_base *port() const { return _port; }
239 const sc_port_base *port() const override { return _port; }
240
240
241 const sc_event &
242 find_event(sc_interface *if_p=NULL) const override
243 {
244 static const sc_gem5::InternalScEvent none;
245 const IF *iface = if_p ? dynamic_cast<const IF *>(if_p) :
246 dynamic_cast<const IF *>(_port->get_interface());
247 if (!iface) {
248 std::ostringstream ss;
249 ss << "port is not bound: port '" << _port->name() << "' (" <<
250 _port->kind() << ")";
251 SC_REPORT_ERROR(SC_ID_FIND_EVENT_, ss.str().c_str());
252 return none;
253 }
254 return (const_cast<IF *>(iface)->*_method)();
255 }
241 const sc_event &find_event(sc_interface *if_p=NULL) const override;
256
257 private:
258 const sc_port_b<IF> *_port;
259 const sc_event &(IF::*_method)() const;
260};
261
262const std::vector<sc_event *> &sc_get_top_level_events();
263sc_event *sc_find_event(const char *);

--- 7 unchanged lines hidden (view full) ---

271{
272 public:
273 InternalScEvent();
274 InternalScEvent(const char *);
275};
276
277} // namespace sc_gem5
278
242
243 private:
244 const sc_port_b<IF> *_port;
245 const sc_event &(IF::*_method)() const;
246};
247
248const std::vector<sc_event *> &sc_get_top_level_events();
249sc_event *sc_find_event(const char *);

--- 7 unchanged lines hidden (view full) ---

257{
258 public:
259 InternalScEvent();
260 InternalScEvent(const char *);
261};
262
263} // namespace sc_gem5
264
265namespace sc_core
266{
267
268template <class IF>
269const sc_event &
270sc_event_finder_t<IF>::find_event(sc_interface *if_p) const
271{
272 static const sc_gem5::InternalScEvent none;
273 const IF *iface = if_p ? dynamic_cast<const IF *>(if_p) :
274 dynamic_cast<const IF *>(_port->get_interface());
275 if (!iface) {
276 std::ostringstream ss;
277 ss << "port is not bound: port '" << _port->name() << "' (" <<
278 _port->kind() << ")";
279 SC_REPORT_ERROR(SC_ID_FIND_EVENT_, ss.str().c_str());
280 return none;
281 }
282 return (const_cast<IF *>(iface)->*_method)();
283}
284
285} // namespace sc_core
286
279#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__
287#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__