112027Sjungma@eit.uni-kl.de/*****************************************************************************
212027Sjungma@eit.uni-kl.de
312027Sjungma@eit.uni-kl.de  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412027Sjungma@eit.uni-kl.de  more contributor license agreements.  See the NOTICE file distributed
512027Sjungma@eit.uni-kl.de  with this work for additional information regarding copyright ownership.
612027Sjungma@eit.uni-kl.de  Accellera licenses this file to you under the Apache License, Version 2.0
712027Sjungma@eit.uni-kl.de  (the "License"); you may not use this file except in compliance with the
812027Sjungma@eit.uni-kl.de  License.  You may obtain a copy of the License at
912027Sjungma@eit.uni-kl.de
1012027Sjungma@eit.uni-kl.de    http://www.apache.org/licenses/LICENSE-2.0
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de  Unless required by applicable law or agreed to in writing, software
1312027Sjungma@eit.uni-kl.de  distributed under the License is distributed on an "AS IS" BASIS,
1412027Sjungma@eit.uni-kl.de  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512027Sjungma@eit.uni-kl.de  implied.  See the License for the specific language governing
1612027Sjungma@eit.uni-kl.de  permissions and limitations under the License.
1712027Sjungma@eit.uni-kl.de
1812027Sjungma@eit.uni-kl.de *****************************************************************************/
1912027Sjungma@eit.uni-kl.de
2012027Sjungma@eit.uni-kl.de/*****************************************************************************
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de  sc_attribute.h -- Attribute classes.
2312027Sjungma@eit.uni-kl.de
2412027Sjungma@eit.uni-kl.de  Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
2512027Sjungma@eit.uni-kl.de
2612027Sjungma@eit.uni-kl.de  CHANGE LOG AT THE END OF THE FILE
2712027Sjungma@eit.uni-kl.de *****************************************************************************/
2812027Sjungma@eit.uni-kl.de
2912027Sjungma@eit.uni-kl.de
3012027Sjungma@eit.uni-kl.de#ifndef SC_ATTRIBUTE_H
3112027Sjungma@eit.uni-kl.de#define SC_ATTRIBUTE_H
3212027Sjungma@eit.uni-kl.de
3312027Sjungma@eit.uni-kl.de#include <string>
3412027Sjungma@eit.uni-kl.de#include <vector>
3512027Sjungma@eit.uni-kl.de
3612027Sjungma@eit.uni-kl.denamespace sc_core {
3712027Sjungma@eit.uni-kl.de
3812027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
3912027Sjungma@eit.uni-kl.de//  CLASS : sc_attr_base
4012027Sjungma@eit.uni-kl.de//
4112027Sjungma@eit.uni-kl.de//  Attribute base class.
4212027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
4312027Sjungma@eit.uni-kl.de
4412027Sjungma@eit.uni-kl.declass sc_attr_base
4512027Sjungma@eit.uni-kl.de{
4612027Sjungma@eit.uni-kl.depublic:
4712027Sjungma@eit.uni-kl.de
4812027Sjungma@eit.uni-kl.de    // constructors
4912027Sjungma@eit.uni-kl.de    sc_attr_base( const std::string& name_ );
5012027Sjungma@eit.uni-kl.de    sc_attr_base( const sc_attr_base& );
5112027Sjungma@eit.uni-kl.de
5212027Sjungma@eit.uni-kl.de    // destructor (does nothing)
5312027Sjungma@eit.uni-kl.de    virtual ~sc_attr_base();
5412027Sjungma@eit.uni-kl.de
5512027Sjungma@eit.uni-kl.de    // get the name
5612027Sjungma@eit.uni-kl.de    const std::string& name() const;
5712027Sjungma@eit.uni-kl.de
5812027Sjungma@eit.uni-kl.deprivate:
5912027Sjungma@eit.uni-kl.de
6012027Sjungma@eit.uni-kl.de    std::string m_name;
6112027Sjungma@eit.uni-kl.de
6212027Sjungma@eit.uni-kl.deprivate:
6312027Sjungma@eit.uni-kl.de
6412027Sjungma@eit.uni-kl.de    // disabled
6512027Sjungma@eit.uni-kl.de    sc_attr_base();
6612027Sjungma@eit.uni-kl.de    sc_attr_base& operator = ( const sc_attr_base& );
6712027Sjungma@eit.uni-kl.de};
6812027Sjungma@eit.uni-kl.de
6912027Sjungma@eit.uni-kl.de
7012027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
7112027Sjungma@eit.uni-kl.de//  CLASS : sc_attr_cltn
7212027Sjungma@eit.uni-kl.de//
7312027Sjungma@eit.uni-kl.de//  Attribute collection class. Stores pointers to attributes.
7412027Sjungma@eit.uni-kl.de//  Note: iterate over the collection by using iterators.
7512027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
7612027Sjungma@eit.uni-kl.de
7712027Sjungma@eit.uni-kl.declass sc_attr_cltn
7812027Sjungma@eit.uni-kl.de{
7912027Sjungma@eit.uni-kl.depublic:
8012027Sjungma@eit.uni-kl.de
8112027Sjungma@eit.uni-kl.de    // typedefs
8212027Sjungma@eit.uni-kl.de    typedef sc_attr_base*                          elem_type;
8312027Sjungma@eit.uni-kl.de    typedef std::vector<elem_type>::iterator       iterator;
8412027Sjungma@eit.uni-kl.de    typedef std::vector<elem_type>::const_iterator const_iterator;
8512027Sjungma@eit.uni-kl.de
8612027Sjungma@eit.uni-kl.de    // constructors
8712027Sjungma@eit.uni-kl.de    sc_attr_cltn();
8812027Sjungma@eit.uni-kl.de    sc_attr_cltn( const sc_attr_cltn& );
8912027Sjungma@eit.uni-kl.de
9012027Sjungma@eit.uni-kl.de    // destructor
9112027Sjungma@eit.uni-kl.de    ~sc_attr_cltn();
9212027Sjungma@eit.uni-kl.de
9312027Sjungma@eit.uni-kl.de    // add attribute to the collection.
9412027Sjungma@eit.uni-kl.de    // returns 'true' if the name of the attribute is unique,
9512027Sjungma@eit.uni-kl.de    // returns 'false' otherwise (attribute is not added).
9612027Sjungma@eit.uni-kl.de    bool push_back( sc_attr_base* );
9712027Sjungma@eit.uni-kl.de
9812027Sjungma@eit.uni-kl.de    // get attribute by name.
9912027Sjungma@eit.uni-kl.de    // returns pointer to attribute, or 0 if name does not exist.
10012027Sjungma@eit.uni-kl.de          sc_attr_base* operator [] ( const std::string& name_ );
10112027Sjungma@eit.uni-kl.de    const sc_attr_base* operator [] ( const std::string& name_ ) const;
10212027Sjungma@eit.uni-kl.de
10312027Sjungma@eit.uni-kl.de    // remove attribute by name.
10412027Sjungma@eit.uni-kl.de    // returns pointer to attribute, or 0 if name does not exist.
10512027Sjungma@eit.uni-kl.de    sc_attr_base* remove( const std::string& name_ );
10612027Sjungma@eit.uni-kl.de
10712027Sjungma@eit.uni-kl.de    // remove all attributes
10812027Sjungma@eit.uni-kl.de    void remove_all();
10912027Sjungma@eit.uni-kl.de
11012027Sjungma@eit.uni-kl.de    // get the size of the collection
11112027Sjungma@eit.uni-kl.de    int size() const
11212027Sjungma@eit.uni-kl.de        { return m_cltn.size(); }
11312027Sjungma@eit.uni-kl.de
11412027Sjungma@eit.uni-kl.de    // get the begin iterator
11512027Sjungma@eit.uni-kl.de    iterator begin()
11612027Sjungma@eit.uni-kl.de        { return m_cltn.begin(); }
11712027Sjungma@eit.uni-kl.de    const_iterator begin() const
11812027Sjungma@eit.uni-kl.de        { return m_cltn.begin(); }
11912027Sjungma@eit.uni-kl.de
12012027Sjungma@eit.uni-kl.de    // get the end iterator
12112027Sjungma@eit.uni-kl.de    iterator end()
12212027Sjungma@eit.uni-kl.de        { return m_cltn.end(); }
12312027Sjungma@eit.uni-kl.de    const_iterator end() const
12412027Sjungma@eit.uni-kl.de        { return m_cltn.end(); }
12512027Sjungma@eit.uni-kl.de
12612027Sjungma@eit.uni-kl.deprivate:
12712027Sjungma@eit.uni-kl.de    std::vector<sc_attr_base*> m_cltn;
12812027Sjungma@eit.uni-kl.de
12912027Sjungma@eit.uni-kl.deprivate:
13012027Sjungma@eit.uni-kl.de
13112027Sjungma@eit.uni-kl.de    // disabled
13212027Sjungma@eit.uni-kl.de    sc_attr_cltn& operator = ( const sc_attr_cltn& );
13312027Sjungma@eit.uni-kl.de};
13412027Sjungma@eit.uni-kl.de
13512027Sjungma@eit.uni-kl.de
13612027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
13712027Sjungma@eit.uni-kl.de//  CLASS : sc_attribute<T>
13812027Sjungma@eit.uni-kl.de//
13912027Sjungma@eit.uni-kl.de//  Attribute class.
14012027Sjungma@eit.uni-kl.de//  Note: T must have a default constructor and copy constructor.
14112027Sjungma@eit.uni-kl.de// ----------------------------------------------------------------------------
14212027Sjungma@eit.uni-kl.de
14312027Sjungma@eit.uni-kl.detemplate <class T>
14412027Sjungma@eit.uni-kl.declass sc_attribute
14512027Sjungma@eit.uni-kl.de: public sc_attr_base
14612027Sjungma@eit.uni-kl.de{
14712027Sjungma@eit.uni-kl.depublic:
14812027Sjungma@eit.uni-kl.de
14912027Sjungma@eit.uni-kl.de    // constructors
15012027Sjungma@eit.uni-kl.de
15112027Sjungma@eit.uni-kl.de    sc_attribute( const std::string& name_ )
15212027Sjungma@eit.uni-kl.de        : sc_attr_base( name_ ), value()
15312027Sjungma@eit.uni-kl.de        {}
15412027Sjungma@eit.uni-kl.de
15512027Sjungma@eit.uni-kl.de    sc_attribute( const std::string& name_, const T& value_ )
15612027Sjungma@eit.uni-kl.de        : sc_attr_base( name_ ), value( value_ )
15712027Sjungma@eit.uni-kl.de        {}
15812027Sjungma@eit.uni-kl.de
15912027Sjungma@eit.uni-kl.de    sc_attribute( const sc_attribute<T>& a )
16012027Sjungma@eit.uni-kl.de        : sc_attr_base( a.name() ), value( a.value )
16112027Sjungma@eit.uni-kl.de        {}
16212027Sjungma@eit.uni-kl.de
16312027Sjungma@eit.uni-kl.de
16412027Sjungma@eit.uni-kl.de    // destructor (does nothing)
16512027Sjungma@eit.uni-kl.de
16612027Sjungma@eit.uni-kl.de    virtual ~sc_attribute()
16712027Sjungma@eit.uni-kl.de        {}
16812027Sjungma@eit.uni-kl.de
16912027Sjungma@eit.uni-kl.depublic:
17012027Sjungma@eit.uni-kl.de
17112027Sjungma@eit.uni-kl.de    // public data member; for easy access
17212027Sjungma@eit.uni-kl.de    T value;
17312027Sjungma@eit.uni-kl.de
17412027Sjungma@eit.uni-kl.deprivate:
17512027Sjungma@eit.uni-kl.de
17612027Sjungma@eit.uni-kl.de    // disabled
17712027Sjungma@eit.uni-kl.de    sc_attribute();
17812027Sjungma@eit.uni-kl.de    sc_attribute<T>& operator = ( const sc_attribute<T>& );
17912027Sjungma@eit.uni-kl.de};
18012027Sjungma@eit.uni-kl.de
18112027Sjungma@eit.uni-kl.de} // namespace sc_core
18212027Sjungma@eit.uni-kl.de
18312027Sjungma@eit.uni-kl.de// $Log: sc_attribute.h,v $
18412027Sjungma@eit.uni-kl.de// Revision 1.6  2011/08/26 20:46:08  acg
18512027Sjungma@eit.uni-kl.de//  Andy Goodrich: moved the modification log to the end of the file to
18612027Sjungma@eit.uni-kl.de//  eliminate source line number skew when check-ins are done.
18712027Sjungma@eit.uni-kl.de//
18812027Sjungma@eit.uni-kl.de// Revision 1.5  2011/02/18 20:27:14  acg
18912027Sjungma@eit.uni-kl.de//  Andy Goodrich: Updated Copyrights.
19012027Sjungma@eit.uni-kl.de//
19112027Sjungma@eit.uni-kl.de// Revision 1.4  2011/02/13 21:47:37  acg
19212027Sjungma@eit.uni-kl.de//  Andy Goodrich: update copyright notice.
19312027Sjungma@eit.uni-kl.de//
19412027Sjungma@eit.uni-kl.de// Revision 1.3  2010/07/22 20:02:33  acg
19512027Sjungma@eit.uni-kl.de//  Andy Goodrich: bug fixes.
19612027Sjungma@eit.uni-kl.de//
19712027Sjungma@eit.uni-kl.de// Revision 1.2  2008/05/22 17:06:24  acg
19812027Sjungma@eit.uni-kl.de//  Andy Goodrich: updated copyright notice to include 2008.
19912027Sjungma@eit.uni-kl.de//
20012027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
20112027Sjungma@eit.uni-kl.de// SystemC 2.3
20212027Sjungma@eit.uni-kl.de//
20312027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:44:29  acg
20412027Sjungma@eit.uni-kl.de// Added $Log to record CVS changes into the source.
20512027Sjungma@eit.uni-kl.de//
20612027Sjungma@eit.uni-kl.de
20712027Sjungma@eit.uni-kl.de#endif
20812027Sjungma@eit.uni-kl.de
20912027Sjungma@eit.uni-kl.de// Taf!
210