Otawa
0.10
|
A contextual property is a special property that allows to retrieve a property value by its contextual path (ContextualPath). More...
#include <otawa/prop/ContextualProperty.h>
Classes | |
class | Node |
Public Member Functions | |
ContextualProperty (void) | |
Build a contextual property. More... | |
const AbstractIdentifier * | id (void) const |
Get the identifier code of the property. More... | |
Property * | next (void) const |
Get the next property. More... | |
template<class T > | |
const T & | get (void) const |
template<class T > | |
void | set (const T &value) |
virtual void | print (elm::io::Output &out) const |
Print the given property, that is, the identifier and its value if any. More... | |
Static Public Member Functions | |
static bool | exists (const PropList &props, const ContextualPath &path, const AbstractIdentifier &id) |
Test if a contextual property exists, that is, the property value is defined at any step of the given contextual path. More... | |
static PropList & | ref (PropList &props, const ContextualPath &path, const AbstractIdentifier &id) |
Obtain a reference on a property value in the given contextual path. More... | |
static const PropList & | find (const PropList &props, const ContextualPath &path, const AbstractIdentifier &id) |
Get a contextual property from a property list. More... | |
static PropList & | make (PropList &props, const ContextualPath &path) |
Set a contextual property. More... | |
static void | print (io::Output &out, const PropList &props) |
Display the contextual information of the given property list. More... | |
static const AbstractIdentifier * | getID (elm::CString name) |
Allocate a new identifier matching the given name. More... | |
Protected Member Functions | |
virtual Property * | copy (void) |
This method is called when a property is copied. More... | |
Private Member Functions | |
const PropList & | findProps (const PropList &props, const ContextualPath &path, const AbstractIdentifier &id) const |
Find the property list matching the best the given path. More... | |
PropList & | makeProps (const ContextualPath &path) |
Find or make the property list for the given path. More... | |
PropList & | refProps (PropList &props, const ContextualPath &path, const AbstractIdentifier &id) |
void | print (io::Output &out, const Node &node, int indent=0) const |
Private Attributes | |
Node | root |
Static Private Attributes | |
static AbstractIdentifier | ID |
Private identifier for contextual properties. More... | |
A contextual property is a special property that allows to retrieve a property value by its contextual path (ContextualPath).
Contextual path allows to takes into account the context of execution of a block, that is, the chaining of function, calls and loop iteration driving to the block. Notice
that the path must be precise while the matching is performed on a blurred contextual tree. This means that some parts of the contextual path may be ignored if an embedding context is found in the contextual property. For example, the path [c1, c2, c3] may match a property whose path is [c1, c3] as it is considered as [c1, *, c2], that is more general that the given path. * means "any
component".
otawa::ContextualProperty::ContextualProperty | ( | void | ) |
|
inlineprotectedvirtualinherited |
This method is called when a property is copied.
It may be specialized by Property class children.
Reimplemented in otawa::LockedProperty< T >, and otawa::GenericProperty< T >.
References otawa::Property::_id, and otawa::Property::Property().
Referenced by refProps().
|
static |
Test if a contextual property exists, that is, the property value is defined at any step of the given contextual path.
props | Property list to look in. |
path | Contextual path. |
id | Looked identifier. |
References findProps(), otawa::PropList::getProp(), and ID.
Referenced by otawa::ContextualPath::Ref< T >::exists().
|
static |
Get a contextual property from a property list.
props | Property list to look in. |
path | Contextual path. |
id | Identifier of the looked property. |
References findProps(), otawa::PropList::getProp(), and ID.
Referenced by otawa::ContextualPath::get().
|
private |
Find the property list matching the best the given path.
path | Path to match. |
stack | Stack of property list leading to the full context. |
References elm::genstruct::Vector< T >::count(), otawa::ContextualPath::count(), elm::genstruct::Vector< T >::push(), root, and otawa::ContextualProperty::Node::step.
|
inlineinherited |
|
staticinherited |
Allocate a new identifier matching the given name.
Note that, if an identifier exists with the same name, its code will be returned ensuring consistency between name and code for identifiers.
name | Name of the identifier. |
References otawa::display::find().
|
inlineinherited |
Get the identifier code of the property.
References otawa::Property::_id.
Referenced by otawa::GenericProperty< T >::copy(), otawa::LockedProperty< T >::copy(), otawa::PropList::Iter::operator!=(), otawa::PropList::Iter::operator==(), and otawa::PropList::setProp().
|
static |
Set a contextual property.
References otawa::PropList::addProp(), ContextualProperty(), otawa::ContextualPath::count(), otawa::PropList::getProp(), ID, and makeProps().
Referenced by otawa::ContextualPath::Ref< T >::add(), refProps(), and otawa::ContextualPath::Ref< T >::remove().
|
private |
Find or make the property list for the given path.
path | Contextual path. |
References elm::inhstruct::Tree::add(), otawa::ContextualPath::count(), root, and otawa::ContextualProperty::Node::step.
Referenced by make().
|
inlineinherited |
Get the next property.
References otawa::Property::_next.
Referenced by otawa::PropList::addProps(), otawa::PropList::clearProps(), otawa::PropList::extractProp(), otawa::PropList::getProp(), otawa::PropList::Iter::next(), otawa::PropList::removeAllProp(), otawa::PropList::removeProp(), and otawa::PropList::setProp().
|
virtualinherited |
Print the given property, that is, the identifier and its value if any.
out | Output to use. |
Referenced by otawa::operator<<().
|
static |
|
private |
References otawa::PropList::print(), print(), and otawa::ContextualProperty::Node::step.
|
static |
Obtain a reference on a property value in the given contextual path.
If the property does not exists, create and return it. If the property exists at an intermediate level, copy it at the top level and return reference to it.
props | Property list to look in. |
path | Contextual path. |
id | Looked identifier. |
References otawa::PropList::addProp(), ContextualProperty(), otawa::ContextualPath::count(), otawa::PropList::getProp(), ID, and refProps().
Referenced by otawa::ContextualPath::Ref< T >::ref().
|
private |
References elm::inhstruct::Tree::add(), otawa::PropList::addProp(), otawa::Property::copy(), otawa::ContextualPath::count(), otawa::PropList::getProp(), make(), root, and otawa::ContextualProperty::Node::step.
Referenced by ref().
|
inlineinherited |
|
staticprivate |
|
private |
Referenced by findProps(), makeProps(), print(), and refProps().