17 #ifndef _SCC_SC_SIGNAL_GP_H_
18 #define _SCC_SC_SIGNAL_GP_H_
20 #include <sysc/communication/sc_signal.h>
35 template <
class T, sc_core::sc_writer_policy POL = sc_core::SC_ONE_WRITER>
class sc_owning_signal :
public sc_core::sc_signal<T*, POL> {
37 using policy_type = sc_core::sc_writer_policy_check<POL>;
38 using super = sc_core::sc_signal<T*, POL>;
43 : sc_core::sc_signal<T*, POL>(sc_core::sc_gen_unique_name(
"signal")) {}
46 : sc_core::sc_signal<T*, POL>(name_,
nullptr) {}
49 : sc_core::sc_signal<T*, POL>(name_, initial_value_) {}
54 void write(
const type& value_)
override {
55 bool value_changed = !(super::m_cur_val == value_);
56 if(!policy_type::check_write(
this, value_changed))
59 if(super::m_new_val && super::m_new_val != super::m_cur_val && super::m_new_val->has_mm())
60 super::m_new_val->release();
61 super::m_new_val = value_;
63 if(super::m_new_val && super::m_new_val->has_mm())
64 super::m_new_val->acquire();
66 super::request_update();
70 super::m_new_val =
nullptr;
71 if(super::m_new_val != super::m_cur_val)
72 super::request_update();
75 using super::operator=;
78 void update()
override {
79 if(!(super::m_new_val == super::m_cur_val)) {
80 if(super::m_cur_val && super::m_cur_val->has_mm())
81 super::m_cur_val->release();
sc_signal which takes ownership of the data (acquire()/release())