Deleted Added
sdiff udiff text old ( 12915:aff42de64e41 ) new ( 12924:f74f34bd41ce )
full compact
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
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_EXT_CORE_SC_EVENT_HH__
31#define __SYSTEMC_EXT_CORE_SC_EVENT_HH__
32
33#include <vector>
34
35#include "sc_time.hh"
36
37namespace sc_core
38{
39
40class sc_event;
41class sc_event_and_expr;
42class sc_event_or_expr;
43class sc_object;
44class sc_port_base;
45
46class sc_event_finder
47{
48 protected:
49 void warn_unimpl(const char *func) const;
50};
51
52template <class IF>
53class sc_event_finder_t : public sc_event_finder
54{
55 public:
56 sc_event_finder_t(const sc_port_base &,
57 const sc_event & (IF::*event_method)() const)
58 {
59 warn_unimpl(__PRETTY_FUNCTION__);
60 }
61};
62
63class sc_event_and_list
64{
65 public:
66 sc_event_and_list();
67 sc_event_and_list(const sc_event_and_list &);
68 sc_event_and_list(const sc_event &);
69 sc_event_and_list &operator = (const sc_event_and_list &);
70
71 int size() const;
72 void swap(sc_event_and_list &);
73
74 sc_event_and_list &operator &= (const sc_event &);
75 sc_event_and_list &operator &= (const sc_event_and_list &);
76
77 sc_event_and_expr operator & (const sc_event &) const;
78 sc_event_and_expr operator & (const sc_event_and_list &);
79};
80
81class sc_event_or_list
82{
83 public:
84 sc_event_or_list();
85 sc_event_or_list(const sc_event_or_list &);
86 sc_event_or_list(const sc_event &);
87 sc_event_or_list& operator = (const sc_event_or_list &);
88 ~sc_event_or_list();
89
90 int size() const;
91 void swap(sc_event_or_list &);
92
93 sc_event_or_list &operator |= (const sc_event &);
94 sc_event_or_list &operator |= (const sc_event_or_list &);
95
96 sc_event_or_expr operator | (const sc_event &) const;
97 sc_event_or_expr operator | (const sc_event_or_list &) const;
98};
99
100class sc_event_and_expr
101{
102 public:
103 operator const sc_event_and_list &() const;
104};
105
106sc_event_and_expr operator & (sc_event_and_expr, sc_event const &);
107sc_event_and_expr operator & (sc_event_and_expr, sc_event_and_list const &);
108
109class sc_event_or_expr
110{
111 public:
112 operator const sc_event_or_list &() const;
113};
114
115sc_event_or_expr operator | (sc_event_or_expr, sc_event const &);
116sc_event_or_expr operator | (sc_event_or_expr, sc_event_or_list const &);
117
118class sc_event
119{
120 public:
121 sc_event();
122 explicit sc_event(const char *);
123 ~sc_event();
124
125 const char *name() const;
126 const char *basename() const;
127 bool in_hierarchy() const;
128 sc_object *get_parent_object() const;
129
130 void notify();
131 void notify(const sc_time &);
132 void notify(double, sc_time_unit);
133 void cancel();
134
135 // Nonstandard
136 // Returns whether this event is currently triggered.
137 bool triggered() const;
138
139 // Deprecated
140 void notify_delayed();
141 void notify_delayed(const sc_time &);
142
143 sc_event_and_expr operator & (const sc_event &) const;
144 sc_event_and_expr operator & (const sc_event_and_list &) const;
145 sc_event_or_expr operator | (const sc_event &) const;
146 sc_event_or_expr operator | (const sc_event_or_list &) const;
147
148 private:
149 // Disabled
150 sc_event(const sc_event &) {}
151 sc_event &operator = (const sc_event &) { return *this; }
152};
153
154const std::vector<sc_event *> &sc_get_top_level_events();
155sc_event *sc_find_event(const char *);
156
157} // namespace sc_core
158
159#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__