pinapa-decoration-base.h File Reference

Base class for decorations of other objects. More...

#include "pinapa-parser-all.h"
#include "pinapa-tree.h"
#include "pinapa-hash.h"

Go to the source code of this file.

Namespaces

namespace  pinapa

Classes

class  pinapa::st_deco_b
class  pinapa::st_deco_first< deco, parent >
class  pinapa::st_deco< deco, parent, grandparent >

Typedefs

typedef st_deco_b * pinapa::deco_b

Functions

template<class parent>
void * pinapa::get_decoration (parent &p)
template<class parent>
void pinapa::set_decoration (parent &p, void *c)


Detailed Description

Base class for decorations of other objects.

The object to decorate must have a public member

 void *
  decoration; 
. This member *must* be initialized to NULL.

Alternatively, a specialisation of the template functions get_decoration() and set_decoration() can be defined. Initially, get_decoration() must return NULL.

A decoration contains a pointer to another decoration, so, it is possible to chain the decoration together. Typically, one decoration will be defined in the parser, and some additional stuff will be added later by the analyzer.

A decoration must be declared like this:

  class st_signal_deco_t {
  ...
  };

  typedef st_deco<st_signal_deco_t,
  sc_prim_channel> st_signal_deco;

  typedef st_signal_deco * signal_deco;

A chained decoration must be declared like this:

  class st_signal_deco_plus_t {
  ...
  };

  typedef st_deco<st_signal_deco_plus_t,
  st_signal_deco,
  sc_prim_channel> st_signal_deco_plus;

  typedef st_signal_deco_plus * signal_deco_plus;

To get the decoration (A new one is create automatically if the decoration had not been initialized previously) of an object O :

  st_signal_deco_plus::get(signal)

And the field of the decoration itself can be accessed through the operator -> :

  x = st_signal_deco_plus::get(signal)->get_signal();
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page