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

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

59class sc_event_finder
60{
61 protected:
62 virtual ~sc_event_finder() {}
63
64 public:
65 // Should be "implementation defined" but used in the tests.
66 virtual const sc_event &find_event(sc_interface *if_p=NULL) const = 0;
67 virtual const sc_port_base *port() const = 0;
68};
69
70template <class IF>
71class sc_event_finder_t : public sc_event_finder
72{
73 public:
74 sc_event_finder_t(const sc_port_base &p,
75 const sc_event & (IF::*_method)() const) :
76 _method(_method)
77 {
78 _port = dynamic_cast<const sc_port_b<IF> *>(&p);
79 assert(_port);
80 }
81
82 virtual ~sc_event_finder_t() {}
83
84 const sc_port_base *port() const { return _port; }
85
86 const sc_event &
87 find_event(sc_interface *if_p=NULL) const override
88 {
89 const IF *iface = if_p ? dynamic_cast<const IF *>(if_p) :
90 dynamic_cast<const IF *>(_port->get_interface());
91 return (const_cast<IF *>(iface)->*_method)();
92 }
93

--- 158 unchanged lines hidden ---