FAUST compiler  0.9.9.6b8
Public Member Functions | Private Member Functions | Private Attributes | List of all members
property< P > Class Template Reference

#include <property.hh>

Inheritance diagram for property< P >:
Inheritance graph
[legend]
Collaboration diagram for property< P >:
Collaboration graph
[legend]

Public Member Functions

 property ()
 
 property (const char *keyname)
 
void set (Tree t, const P &data)
 
bool get (Tree t, P &data)
 
void clear (Tree t)
 

Private Member Functions

Paccess (Tree t)
 

Private Attributes

Tree fKey
 

Detailed Description

template<class P>
class property< P >

Definition at line 6 of file property.hh.

Constructor & Destructor Documentation

template<class P>
property< P >::property ( )
inline

Definition at line 18 of file property.hh.

18 : fKey(tree(Node(unique("property_")))) {}
Symbol * unique(const char *str)
Returns a new unique symbol of name strxxx.
Definition: symbol.hh:97
Class Node = (type x (int + double + Sym + void*))
Definition: node.hh:75
Tree tree(const Node &n)
Definition: tree.hh:186
Tree fKey
Definition: property.hh:8
template<class P>
property< P >::property ( const char *  keyname)
inline

Definition at line 20 of file property.hh.

20 : fKey(tree(Node(keyname))) {}
Class Node = (type x (int + double + Sym + void*))
Definition: node.hh:75
Tree tree(const Node &n)
Definition: tree.hh:186
Tree fKey
Definition: property.hh:8

Member Function Documentation

template<class P>
P* property< P >::access ( Tree  t)
inlineprivate

Definition at line 10 of file property.hh.

Referenced by property< Loop * >::clear(), property< Loop * >::get(), and property< Loop * >::set().

11  {
12  Tree d = t->getProperty(fKey);
13  return d ? (P*)(d->node().getPointer()) : 0;
14  }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
const Node & node() const
return the content of the tree
Definition: tree.hh:143
Tree getProperty(Tree key)
Definition: tree.hh:173
void * getPointer() const
Definition: node.hh:107
Tree fKey
Definition: property.hh:8

Here is the caller graph for this function:

template<class P>
void property< P >::clear ( Tree  t)
inline

Definition at line 43 of file property.hh.

44  {
45  P* p = access(t);
46  if (p) { delete p; }
47  t->clearProperty(fKey);
48  }
P * access(Tree t)
Definition: property.hh:10
void clearProperty(Tree key)
Definition: tree.hh:168
Tree fKey
Definition: property.hh:8
template<class P>
bool property< P >::get ( Tree  t,
P data 
)
inline

Definition at line 32 of file property.hh.

Referenced by DocCompiler::getCompiledExpression(), Klass::getLoopProperty(), DocCompiler::getVectorNameProperty(), makeSimpleType(), makeTableType(), and makeTupletType().

33  {
34  P* p = access(t);
35  if (p) {
36  data = *p;
37  return true;
38  } else {
39  return false;
40  }
41  }
P * access(Tree t)
Definition: property.hh:10

Here is the caller graph for this function:

template<class P>
void property< P >::set ( Tree  t,
const P data 
)
inline

Definition at line 22 of file property.hh.

Referenced by makeSimpleType(), makeTableType(), makeTupletType(), DocCompiler::setCompiledExpression(), Klass::setLoopProperty(), and DocCompiler::setVectorNameProperty().

23  {
24  P* p = access(t);
25  if (p) {
26  *p = data;
27  } else {
28  t->setProperty(fKey, tree(Node(new P(data))));
29  }
30  }
Class Node = (type x (int + double + Sym + void*))
Definition: node.hh:75
void setProperty(Tree key, Tree value)
Definition: tree.hh:167
P * access(Tree t)
Definition: property.hh:10
Tree tree(const Node &n)
Definition: tree.hh:186
Tree fKey
Definition: property.hh:8

Here is the caller graph for this function:

Member Data Documentation

template<class P>
Tree property< P >::fKey
private

The documentation for this class was generated from the following file: