112853Sgabeblack@google.com/*****************************************************************************
212853Sgabeblack@google.com
312853Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412853Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512853Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612853Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712853Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812853Sgabeblack@google.com  License.  You may obtain a copy of the License at
912853Sgabeblack@google.com
1012853Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112853Sgabeblack@google.com
1212853Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312853Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412853Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512853Sgabeblack@google.com  implied.  See the License for the specific language governing
1612853Sgabeblack@google.com  permissions and limitations under the License.
1712853Sgabeblack@google.com
1812853Sgabeblack@google.com *****************************************************************************/
1912853Sgabeblack@google.com
2012853Sgabeblack@google.com/*****************************************************************************
2112853Sgabeblack@google.com
2212853Sgabeblack@google.com  sc_length_param.h -
2312853Sgabeblack@google.com
2412853Sgabeblack@google.com  Original Author: Martin Janssen, Synopsys, Inc., 2002-03-19
2512853Sgabeblack@google.com
2612853Sgabeblack@google.com *****************************************************************************/
2712853Sgabeblack@google.com
2812853Sgabeblack@google.com/*****************************************************************************
2912853Sgabeblack@google.com
3012853Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112853Sgabeblack@google.com  changes you are making here.
3212853Sgabeblack@google.com
3312853Sgabeblack@google.com      Name, Affiliation, Date:
3412853Sgabeblack@google.com  Description of Modification:
3512853Sgabeblack@google.com
3612853Sgabeblack@google.com *****************************************************************************/
3712853Sgabeblack@google.com
3812853Sgabeblack@google.com// $Log: sc_length_param.h,v $
3912853Sgabeblack@google.com// Revision 1.3  2011/08/24 22:05:46  acg
4012853Sgabeblack@google.com//  Torsten Maehne: initialization changes to remove warnings.
4112853Sgabeblack@google.com//
4212853Sgabeblack@google.com// Revision 1.2  2011/02/18 20:19:15  acg
4312853Sgabeblack@google.com//  Andy Goodrich: updating Copyright notice.
4412853Sgabeblack@google.com//
4512853Sgabeblack@google.com// Revision 1.1.1.1  2006/12/15 20:20:05  acg
4612853Sgabeblack@google.com// SystemC 2.3
4712853Sgabeblack@google.com//
4812853Sgabeblack@google.com// Revision 1.4  2006/05/08 17:50:01  acg
4912853Sgabeblack@google.com//   Andy Goodrich: Added David Long's declarations for friend operators,
5012853Sgabeblack@google.com//   functions, and methods, to keep the Microsoft compiler happy.
5112853Sgabeblack@google.com//
5212853Sgabeblack@google.com// Revision 1.3  2006/01/13 18:49:32  acg
5312853Sgabeblack@google.com// Added $Log command so that CVS check in comments are reproduced in the
5412853Sgabeblack@google.com// source.
5512853Sgabeblack@google.com//
5612853Sgabeblack@google.com
5712853Sgabeblack@google.com#ifndef __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
5812853Sgabeblack@google.com#define __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
5912853Sgabeblack@google.com
6012853Sgabeblack@google.com#include <iostream>
6112853Sgabeblack@google.com
6212853Sgabeblack@google.com#include "../fx/sc_context.hh"
6312853Sgabeblack@google.com#include "../fx/sc_fxdefs.hh"
6412853Sgabeblack@google.com
6512853Sgabeblack@google.comnamespace sc_dt
6612853Sgabeblack@google.com{
6712853Sgabeblack@google.com
6812853Sgabeblack@google.com// classes defined in this module
6912853Sgabeblack@google.comclass sc_length_param;
7012853Sgabeblack@google.com
7112853Sgabeblack@google.com// friend operator declarations
7212853Sgabeblack@google.combool operator == (const sc_length_param &, const sc_length_param &);
7312853Sgabeblack@google.combool operator != (const sc_length_param &, const sc_length_param &);
7412853Sgabeblack@google.com
7512853Sgabeblack@google.com
7612853Sgabeblack@google.com// ----------------------------------------------------------------------------
7712853Sgabeblack@google.com//  CLASS : sc_length_param
7812853Sgabeblack@google.com//
7912853Sgabeblack@google.com//  Length parameter type.
8012853Sgabeblack@google.com// ----------------------------------------------------------------------------
8112853Sgabeblack@google.com
8212853Sgabeblack@google.comclass sc_length_param
8312853Sgabeblack@google.com{
8412853Sgabeblack@google.com  public:
8512853Sgabeblack@google.com    sc_length_param();
8612853Sgabeblack@google.com    sc_length_param(int);
8712853Sgabeblack@google.com    sc_length_param(const sc_length_param &);
8812853Sgabeblack@google.com    explicit sc_length_param(sc_without_context);
8912853Sgabeblack@google.com
9012853Sgabeblack@google.com    sc_length_param &operator = (const sc_length_param &);
9112853Sgabeblack@google.com
9212853Sgabeblack@google.com    friend bool operator == (const sc_length_param &, const sc_length_param &);
9312853Sgabeblack@google.com    friend bool operator != (const sc_length_param &, const sc_length_param &);
9412853Sgabeblack@google.com
9512853Sgabeblack@google.com    int len() const;
9612853Sgabeblack@google.com    void len(int);
9712853Sgabeblack@google.com
9812853Sgabeblack@google.com    const std::string to_string() const;
9912853Sgabeblack@google.com
10012853Sgabeblack@google.com    void print(::std::ostream & =::std::cout) const;
10112853Sgabeblack@google.com    void dump(::std::ostream & =::std::cout) const;
10212853Sgabeblack@google.com
10312853Sgabeblack@google.com  private:
10412853Sgabeblack@google.com    int m_len;
10512853Sgabeblack@google.com};
10612853Sgabeblack@google.com
10712853Sgabeblack@google.com} // namespace sc_dt
10812853Sgabeblack@google.com
10912853Sgabeblack@google.com// ----------------------------------------------------------------------------
11012853Sgabeblack@google.com//  TYPEDEF : sc_length_context
11112853Sgabeblack@google.com//
11212853Sgabeblack@google.com//  Context type for the length parameter type.
11312853Sgabeblack@google.com// ----------------------------------------------------------------------------
11412853Sgabeblack@google.com
11512853Sgabeblack@google.comnamespace sc_dt
11612853Sgabeblack@google.com{
11712853Sgabeblack@google.com
11812853Sgabeblack@google.comextern template class sc_global<sc_length_param>;
11912853Sgabeblack@google.comextern template class sc_context<sc_length_param>;
12012853Sgabeblack@google.com
12112853Sgabeblack@google.comtypedef sc_context<sc_length_param> sc_length_context;
12212853Sgabeblack@google.com
12312853Sgabeblack@google.com
12412853Sgabeblack@google.com// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
12512853Sgabeblack@google.com
12612853Sgabeblack@google.cominline sc_length_param::sc_length_param() : m_len()
12712853Sgabeblack@google.com{
12812853Sgabeblack@google.com    *this = sc_length_context::default_value();
12912853Sgabeblack@google.com}
13012853Sgabeblack@google.com
13112853Sgabeblack@google.cominline sc_length_param::sc_length_param(int len_) : m_len(len_)
13212853Sgabeblack@google.com{
13312853Sgabeblack@google.com    SC_CHECK_WL_(len_);
13412853Sgabeblack@google.com}
13512853Sgabeblack@google.com
13612853Sgabeblack@google.cominline sc_length_param::sc_length_param(const sc_length_param &a) :
13712853Sgabeblack@google.com        m_len(a.m_len)
13812853Sgabeblack@google.com{}
13912853Sgabeblack@google.com
14012853Sgabeblack@google.cominline sc_length_param::sc_length_param(sc_without_context) :
14112853Sgabeblack@google.com        m_len(SC_DEFAULT_WL_)
14212853Sgabeblack@google.com{}
14312853Sgabeblack@google.com
14412853Sgabeblack@google.com
14512853Sgabeblack@google.cominline sc_length_param &
14612853Sgabeblack@google.comsc_length_param::operator = (const sc_length_param &a)
14712853Sgabeblack@google.com{
14812853Sgabeblack@google.com    if (&a != this) {
14912853Sgabeblack@google.com        m_len = a.m_len;
15012853Sgabeblack@google.com    }
15112853Sgabeblack@google.com    return *this;
15212853Sgabeblack@google.com}
15312853Sgabeblack@google.com
15412853Sgabeblack@google.com
15512853Sgabeblack@google.cominline bool
15612853Sgabeblack@google.comoperator == (const sc_length_param &a, const sc_length_param &b)
15712853Sgabeblack@google.com{
15812853Sgabeblack@google.com    return (a.m_len == b.m_len);
15912853Sgabeblack@google.com}
16012853Sgabeblack@google.com
16112853Sgabeblack@google.cominline bool
16212853Sgabeblack@google.comoperator != (const sc_length_param &a, const sc_length_param &b)
16312853Sgabeblack@google.com{
16412853Sgabeblack@google.com    return (a.m_len != b.m_len);
16512853Sgabeblack@google.com}
16612853Sgabeblack@google.com
16712853Sgabeblack@google.com
16812853Sgabeblack@google.cominline int
16912853Sgabeblack@google.comsc_length_param::len() const
17012853Sgabeblack@google.com{
17112853Sgabeblack@google.com    return m_len;
17212853Sgabeblack@google.com}
17312853Sgabeblack@google.com
17412853Sgabeblack@google.cominline void
17512853Sgabeblack@google.comsc_length_param::len(int len_)
17612853Sgabeblack@google.com{
17712853Sgabeblack@google.com    SC_CHECK_WL_(len_);
17812853Sgabeblack@google.com    m_len = len_;
17912853Sgabeblack@google.com}
18012853Sgabeblack@google.com
18112853Sgabeblack@google.com
18212853Sgabeblack@google.cominline ::std::ostream &
18312853Sgabeblack@google.comoperator << (::std::ostream &os, const sc_length_param &a)
18412853Sgabeblack@google.com{
18512853Sgabeblack@google.com    a.print(os);
18612853Sgabeblack@google.com    return os;
18712853Sgabeblack@google.com}
18812853Sgabeblack@google.com
18912853Sgabeblack@google.com} // namespace sc_dt
19012853Sgabeblack@google.com
19112853Sgabeblack@google.com
19212853Sgabeblack@google.com#endif // __SYSTEMC_EXT_DT_INT_SC_LENGTH_PARAM_HH__
193