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 override { return _port; } |
240 |
241 const sc_event &find_event(sc_interface *if_p=NULL) const override; |
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 |
287#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__ |