1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  sc_fxnum_observer.h -
23
24  Original Author: Martin Janssen, Synopsys, Inc.
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38// $Log: sc_fxnum_observer.h,v $
39// Revision 1.1.1.1  2006/12/15 20:20:04  acg
40// SystemC 2.3
41//
42// Revision 1.3  2006/01/13 18:53:58  acg
43// Andy Goodrich: added $Log command so that CVS comments are reproduced in
44// the source.
45//
46
47#ifndef __SYSTEMC_EXT_DT_FX_SC_FXNUM_OBSERVER_HH__
48#define __SYSTEMC_EXT_DT_FX_SC_FXNUM_OBSERVER_HH__
49
50#include "sc_fxdefs.hh"
51
52namespace sc_dt
53{
54
55// classes defined in this module
56class sc_fxnum_observer;
57class sc_fxnum_fast_observer;
58
59// forward class declarations
60class sc_fxnum;
61class sc_fxnum_fast;
62
63#ifdef SC_ENABLE_OBSERVERS
64
65#define SC_FXNUM_OBSERVER_CONSTRUCT_(object) \
66    SC_OBSERVER_(object, sc_fxnum_observer *, construct)
67#define SC_FXNUM_OBSERVER_DESTRUCT_(object) \
68    SC_OBSERVER_(object, sc_fxnum_observer *, destruct)
69#define SC_FXNUM_OBSERVER_READ_(object) \
70    SC_OBSERVER_(object, sc_fxnum_observer *, read)
71#define SC_FXNUM_OBSERVER_WRITE_(object) \
72    SC_OBSERVER_(object, sc_fxnum_observer *, write)
73#define SC_FXNUM_OBSERVER_DEFAULT_ \
74    SC_OBSERVER_DEFAULT_(sc_fxnum_observer)
75
76#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object) \
77    SC_OBSERVER_(object, sc_fxnum_fast_observer *, construct)
78#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object) \
79    SC_OBSERVER_(object, sc_fxnum_fast_observer *, destruct)
80#define SC_FXNUM_FAST_OBSERVER_READ_(object) \
81    SC_OBSERVER_(object, sc_fxnum_fast_observer *, read)
82#define SC_FXNUM_FAST_OBSERVER_WRITE_(object) \
83    SC_OBSERVER_(object, sc_fxnum_fast_observer *, write)
84#define SC_FXNUM_FAST_OBSERVER_DEFAULT_ \
85    SC_OBSERVER_DEFAULT_(sc_fxnum_fast_observer)
86
87#else
88
89#define SC_FXNUM_OBSERVER_CONSTRUCT_(object)
90#define SC_FXNUM_OBSERVER_DESTRUCT_(object)
91#define SC_FXNUM_OBSERVER_READ_(object)
92#define SC_FXNUM_OBSERVER_WRITE_(object)
93#define SC_FXNUM_OBSERVER_DEFAULT_
94
95#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object)
96#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object)
97#define SC_FXNUM_FAST_OBSERVER_READ_(object)
98#define SC_FXNUM_FAST_OBSERVER_WRITE_(object)
99#define SC_FXNUM_FAST_OBSERVER_DEFAULT_
100
101#endif
102
103
104// ----------------------------------------------------------------------------
105//  CLASS : sc_fxnum_observer
106//
107//  Abstract base class for fixed-point types observers; arbitrary precision.
108// ----------------------------------------------------------------------------
109
110class sc_fxnum_observer
111{
112  protected:
113    sc_fxnum_observer() {}
114    virtual ~sc_fxnum_observer() {}
115
116  public:
117    virtual void construct(const sc_fxnum &);
118    virtual void destruct(const sc_fxnum &);
119    virtual void read(const sc_fxnum &);
120    virtual void write(const sc_fxnum &);
121
122    static sc_fxnum_observer *(* default_observer)();
123};
124
125
126// ----------------------------------------------------------------------------
127//  CLASS : sc_fxnum_fast_observer
128//
129//  Abstract base class for fixed-point types observers; limited precision.
130// ----------------------------------------------------------------------------
131
132class sc_fxnum_fast_observer
133{
134  protected:
135    sc_fxnum_fast_observer() {}
136    virtual ~sc_fxnum_fast_observer() {}
137
138  public:
139    virtual void construct(const sc_fxnum_fast &);
140    virtual void destruct(const sc_fxnum_fast &);
141    virtual void read(const sc_fxnum_fast &);
142    virtual void write(const sc_fxnum_fast &);
143
144    static sc_fxnum_fast_observer *(* default_observer) ();
145};
146
147
148// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
149
150// ----------------------------------------------------------------------------
151//  CLASS : sc_fxnum_observer
152//
153//  Abstract base class for fixed-point types observers; arbitrary precision.
154// ----------------------------------------------------------------------------
155
156inline void sc_fxnum_observer::construct(const sc_fxnum &) {}
157inline void sc_fxnum_observer::destruct(const sc_fxnum &) {}
158inline void sc_fxnum_observer::read(const sc_fxnum &) {}
159inline void sc_fxnum_observer::write(const sc_fxnum &) {}
160
161
162// ----------------------------------------------------------------------------
163//  CLASS : sc_fxnum_fast_observer
164//
165//  Abstract base class for fixed-point types observers; limited precision.
166// ----------------------------------------------------------------------------
167
168inline void sc_fxnum_fast_observer::construct(const sc_fxnum_fast &) {}
169inline void sc_fxnum_fast_observer::destruct(const sc_fxnum_fast &) {}
170inline void sc_fxnum_fast_observer::read(const sc_fxnum_fast &) {}
171inline void sc_fxnum_fast_observer::write(const sc_fxnum_fast &) {}
172
173} // namespace sc_dt
174
175#endif // __SYSTEMC_EXT_DT_FX_SC_FXNUM_OBSERVER_HH__
176