sc_out.hh revision 13070:b34c2606011e
110249Sstephan.diestelhorst@arm.com/*
210249Sstephan.diestelhorst@arm.com * Copyright 2018 Google, Inc.
310249Sstephan.diestelhorst@arm.com *
410249Sstephan.diestelhorst@arm.com * Redistribution and use in source and binary forms, with or without
510249Sstephan.diestelhorst@arm.com * modification, are permitted provided that the following conditions are
610249Sstephan.diestelhorst@arm.com * met: redistributions of source code must retain the above copyright
710249Sstephan.diestelhorst@arm.com * notice, this list of conditions and the following disclaimer;
810249Sstephan.diestelhorst@arm.com * redistributions in binary form must reproduce the above copyright
910249Sstephan.diestelhorst@arm.com * notice, this list of conditions and the following disclaimer in the
1010249Sstephan.diestelhorst@arm.com * documentation and/or other materials provided with the distribution;
1110249Sstephan.diestelhorst@arm.com * neither the name of the copyright holders nor the names of its
1210249Sstephan.diestelhorst@arm.com * contributors may be used to endorse or promote products derived from
1310249Sstephan.diestelhorst@arm.com * this software without specific prior written permission.
1410249Sstephan.diestelhorst@arm.com *
1510249Sstephan.diestelhorst@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1610249Sstephan.diestelhorst@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1710249Sstephan.diestelhorst@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1810249Sstephan.diestelhorst@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1910249Sstephan.diestelhorst@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2010249Sstephan.diestelhorst@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2110249Sstephan.diestelhorst@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2210249Sstephan.diestelhorst@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2310249Sstephan.diestelhorst@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2410249Sstephan.diestelhorst@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2510249Sstephan.diestelhorst@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2610249Sstephan.diestelhorst@arm.com *
2710249Sstephan.diestelhorst@arm.com * Authors: Gabe Black
2810249Sstephan.diestelhorst@arm.com */
2910249Sstephan.diestelhorst@arm.com
3010249Sstephan.diestelhorst@arm.com#ifndef __SYSTEMC_EXT_CHANNEL_SC_OUT_HH__
3110249Sstephan.diestelhorst@arm.com#define __SYSTEMC_EXT_CHANNEL_SC_OUT_HH__
3210249Sstephan.diestelhorst@arm.com
3310249Sstephan.diestelhorst@arm.com#include "../core/sc_port.hh"
3410249Sstephan.diestelhorst@arm.com#include "sc_inout.hh"
3510249Sstephan.diestelhorst@arm.com#include "warn_unimpl.hh"
3610249Sstephan.diestelhorst@arm.com
3710249Sstephan.diestelhorst@arm.comnamespace sc_core
3810249Sstephan.diestelhorst@arm.com{
3910249Sstephan.diestelhorst@arm.com
4010249Sstephan.diestelhorst@arm.comtemplate <class T>
4110249Sstephan.diestelhorst@arm.comclass sc_out : public sc_inout<T>
4210249Sstephan.diestelhorst@arm.com{
4310249Sstephan.diestelhorst@arm.com  public:
4410249Sstephan.diestelhorst@arm.com    sc_out() : sc_inout<T>() {}
4510249Sstephan.diestelhorst@arm.com    explicit sc_out(const char *name) : sc_inout<T>(name) {}
4610249Sstephan.diestelhorst@arm.com    virtual ~sc_out() {}
4710249Sstephan.diestelhorst@arm.com
4810249Sstephan.diestelhorst@arm.com    // Deprecated binding constructors.
4910249Sstephan.diestelhorst@arm.com    explicit sc_out(const sc_signal_inout_if<T> &interface) :
5010249Sstephan.diestelhorst@arm.com        sc_inout<T>(interface)
5110249Sstephan.diestelhorst@arm.com    {}
5210249Sstephan.diestelhorst@arm.com    sc_out(const char *name, const sc_signal_inout_if<T> &interface) :
5310249Sstephan.diestelhorst@arm.com        sc_inout<T>(name, interface)
5410249Sstephan.diestelhorst@arm.com    {}
5510249Sstephan.diestelhorst@arm.com    explicit sc_out(sc_port_b<sc_signal_inout_if<T> > &parent) :
5610249Sstephan.diestelhorst@arm.com        sc_inout<T>(parent)
5710249Sstephan.diestelhorst@arm.com    {}
5810249Sstephan.diestelhorst@arm.com    sc_out(const char *name, sc_port_b<sc_signal_inout_if<T> > &parent) :
5910249Sstephan.diestelhorst@arm.com        sc_inout<T>(name, parent)
6010249Sstephan.diestelhorst@arm.com    {}
6110249Sstephan.diestelhorst@arm.com    explicit sc_out(sc_out<T> &parent) : sc_inout<T>(parent) {}
6210249Sstephan.diestelhorst@arm.com    sc_out(const char *name, sc_out<T> &parent) : sc_inout<T>(name, parent) {}
6310249Sstephan.diestelhorst@arm.com
6410249Sstephan.diestelhorst@arm.com    sc_out<T> &
6510249Sstephan.diestelhorst@arm.com    operator = (const T &t)
6610249Sstephan.diestelhorst@arm.com    {
6710249Sstephan.diestelhorst@arm.com        sc_inout<T>::operator = (t);
6810249Sstephan.diestelhorst@arm.com        return *this;
6910249Sstephan.diestelhorst@arm.com    }
7010249Sstephan.diestelhorst@arm.com    sc_out<T> &
7110249Sstephan.diestelhorst@arm.com    operator = (const sc_signal_in_if<T> &c)
7210249Sstephan.diestelhorst@arm.com    {
7310249Sstephan.diestelhorst@arm.com        sc_inout<T>::operator = (c);
7410249Sstephan.diestelhorst@arm.com        return *this;
7510249Sstephan.diestelhorst@arm.com    }
7610249Sstephan.diestelhorst@arm.com    sc_out<T> &
7710249Sstephan.diestelhorst@arm.com    operator = (const sc_port<sc_signal_in_if<T>, 1> &c)
7810249Sstephan.diestelhorst@arm.com    {
7910249Sstephan.diestelhorst@arm.com        sc_inout<T>::operator = (c);
8010249Sstephan.diestelhorst@arm.com        return *this;
8110249Sstephan.diestelhorst@arm.com    }
8210249Sstephan.diestelhorst@arm.com    sc_out<T> &
8310249Sstephan.diestelhorst@arm.com    operator = (const sc_port<sc_signal_inout_if<T>, 1> &c)
8410249Sstephan.diestelhorst@arm.com    {
8510249Sstephan.diestelhorst@arm.com        sc_inout<T>::operator = (c);
8610249Sstephan.diestelhorst@arm.com        return *this;
8710249Sstephan.diestelhorst@arm.com    }
8810249Sstephan.diestelhorst@arm.com    sc_out<T> &
8910249Sstephan.diestelhorst@arm.com    operator = (const sc_out<T> &c)
9010249Sstephan.diestelhorst@arm.com    {
9110249Sstephan.diestelhorst@arm.com        sc_inout<T>::operator = (c);
9210249Sstephan.diestelhorst@arm.com        return *this;
9310249Sstephan.diestelhorst@arm.com    }
9410249Sstephan.diestelhorst@arm.com
9510249Sstephan.diestelhorst@arm.com    virtual const char *kind() const { return "sc_out"; }
9610249Sstephan.diestelhorst@arm.com
9710249Sstephan.diestelhorst@arm.com  private:
9810249Sstephan.diestelhorst@arm.com    // Disabled
9910249Sstephan.diestelhorst@arm.com    sc_out(const sc_out<T> &) : sc_inout<T>() {}
10010249Sstephan.diestelhorst@arm.com};
10110249Sstephan.diestelhorst@arm.com
10210249Sstephan.diestelhorst@arm.com} // namespace sc_core
10310249Sstephan.diestelhorst@arm.com
10410249Sstephan.diestelhorst@arm.com#endif  //__SYSTEMC_EXT_CHANNEL_SC_OUT_HH__
10510249Sstephan.diestelhorst@arm.com