link to homepage

Institute for Neuroscience and Medicine

Navigation and service


API documentation

Attribute Class Reference

Attribute class. Attributes are private member variables of a Prototype which are accessible through XML and, thus, they are subject to observation mechanism. More...

#include <Attribute.h>

Collaboration diagram for Attribute:

List of all members.

Public Member Functions

 Attribute (const string &name, Prototype *proto, const bool &pub, const bool &obs, const double &val)
 Constructors: must provide name (XML), Prototype, public/observable status, and the member variable.
 Attribute (const string &name, Prototype *proto, const bool &pub, const bool &obs)
 Constructor for an unobservable Attribute which does not represent a member variable.
virtual ~Attribute ()
 Destructor deletes local copies of Prototype member variables.
bool IsPublic () const
 Check, if this attribute is public for manipulation through XML.
void SetPublic (bool val)
 Set this attribute to be public for manipulation through XML.
bool IsObservable () const
 Check, if this attribute is observable by other attributes.
void SetObservable (bool val)
 Set this attribute to be observable by other attributes.
bool IsDynamic () const
 Check, if this attribute is dynamic. This is needed for exporting static XML Files of the Sequence.
void SetDynamic (bool val)
 Set this attribute to be dynamic.
int GetDiff ()
 Get the number of symbolic differentiations of the attribute's expression.
double GetImaginary ()
 Get the imaginary part the attribute's evaluation.
bool IsComplex () const
 Check, if this attribute's evaluation is complex.
void SetDiff (int val=0, string sym="diff")
 Set the number of symbolic differentiations of the attribute's expression.
string GetName () const
 Get the name of the attribute.
string GetTypeID () const
 Get the type ID of the attribute.
void * GetAddress () const
 Get the pointer to the value represented by this attribute.
PrototypeGetPrototype () const
 Get the pointer to the Prototype to which this attribute belongs.
string GetSymbol ()
 Get the GiNaC symbol of this attribute.
bool SetMember (string expr, const vector< Attribute * > &obs_attribs, bool verbose=false)
 Set the Prototype's private member represented by this attribute. The function performs the following tasks:

  • write a value to the Prototype's private member, in case of non-dynamic expressions
  • add all observed attributes which are necessary for GiNaC evaluation
  • set the GiNaC expression to calculate the value for the Prototype's private member
  • test once, if evaluation is possible.

void EvalExpression ()
 Evaluate the GiNaC expression of this attribute.
double EvalCompiledExpression (double const val, string const attrib)
 Evaluate the compiled GiNaC expression of this attribute.
double EvalCompiledNLGExpression (double const x, double const y, double const z, double const g)
 Evaluate the compiled GiNaC expression of the NLG attribute (nonlinear gradients).
bool HasGinacExCompiler ()
 True, if GiNaC external compiler is available on this system.
int GetNumberFunctionPointers ()
 Return the total number of function pointers.
int GetCurrentFunctionPointer ()
 Return the counter to the current function pointer.
void ResetCurrentFunctionPointer ()
 Set the counter to the current function pointer to zero.
void StepCurrentFunctionPointer ()
 Increase the counter to the current function pointer by one.
template<typename T >
bool Notify (const T &val)
 Notify all observers.
template<typename T >
bool NewState (const T &val)
 Check the state of the value represented by this attribute.
void AttachObserver (Attribute *attrib)
 Append a new observer of this attribute.
void AttachSubject (Attribute *attrib)
 Append a new subject observed by this this attribute.

Detailed Description

Attribute class. Attributes are private member variables of a Prototype which are accessible through XML and, thus, they are subject to observation mechanism.

Definition at line 54 of file Attribute.h.


Member Function Documentation

void Attribute::AttachObserver ( Attribute attrib  ) 

Append a new observer of this attribute.

Parameters:
attr The observing attribute.

Definition at line 44 of file Attribute.cpp.

References AttachSubject(), Prototype::GetName(), and IsObservable().

Referenced by AttachSubject().

Here is the call graph for this function:

Here is the caller graph for this function:

void Attribute::AttachSubject ( Attribute attrib  ) 

Append a new subject observed by this this attribute.

Parameters:
attr The observed attribute.

Definition at line 55 of file Attribute.cpp.

References AttachObserver(), and IsObservable().

Referenced by AttachObserver(), Prototype::Observe(), and SetMember().

Here is the call graph for this function:

Here is the caller graph for this function:

double Attribute::EvalCompiledExpression ( double const   val,
string const   attrib 
)

Evaluate the compiled GiNaC expression of this attribute.

At first call, performs runtime compilation of the GiNaC expression. Then, compiled function evaluation is returned. Runtime compilation is repeated, if the expression changes according to notification of observed attributes in the expression. Attention: 1) Only to be used for attributes of type double. 2) The evaluation is NOT written to the Prototype's private member represented by this attribute. 3) Attributes observing this attribute are NOT notified. 4) Falls back to slow analytic evaluation, if external compilation fails.

Parameters:
val function input value
attrib attribute representing the function input value
Returns:
expression evaluation

Definition at line 209 of file Attribute.cpp.

References EvalExpression(), get_symbol(), GetAddress(), Prototype::GetAttribute(), Prototype::GetName(), GetName(), GetPrototype(), GetSymbol(), GetTypeID(), and Prototype::ReplaceString().

Referenced by EmptyPulse::SetTPOIs().

Here is the call graph for this function:

Here is the caller graph for this function:

double Attribute::EvalCompiledNLGExpression ( double const   x,
double const   y,
double const   z,
double const   g 
)

Evaluate the compiled GiNaC expression of the NLG attribute (nonlinear gradients).

At first call, performs runtime compilation of the GiNaC expression. Then, compiled function evaluation is returned.

Parameters:
x x position of spin
y y position of spin
z z position of spin
Returns:
expression evaluation

Definition at line 298 of file Attribute.cpp.

References EvalExpression(), get_symbol(), GetAddress(), Prototype::GetAttribute(), Prototype::GetName(), GetName(), GetPrototype(), GetSymbol(), and GetTypeID().

Referenced by GradPulse::SetNonLinGradField().

Here is the call graph for this function:

Here is the caller graph for this function:

void Attribute::EvalExpression (  ) 

Evaluate the GiNaC expression of this attribute.

The evaluation depends on the current state of all observed attributes. It is written to the Prototype's private member represented by this attribute. Afterwards, attributes observing this attribute are notified.

Definition at line 145 of file Attribute.cpp.

References GetName(), Prototype::GetName(), GetPrototype(), GetTypeID(), Prototype::GetVector(), and Prototype::ReplaceString().

Referenced by EvalCompiledExpression(), EvalCompiledNLGExpression(), AnalyticCoil::GetSensitivity(), GradPulse::PrepareNLGfield(), and SetMember().

Here is the call graph for this function:

Here is the caller graph for this function:

void* Attribute::GetAddress (  )  const [inline]

Get the pointer to the value represented by this attribute.

Returns:
The pointer to the value of the attribute.

Definition at line 192 of file Attribute.h.

Referenced by Module::AddAllDOMattributes(), EvalCompiledExpression(), EvalCompiledNLGExpression(), and GradPulse::GradPulse().

Here is the caller graph for this function:

int Attribute::GetDiff (  )  [inline]

Get the number of symbolic differentiations of the attribute's expression.

Returns:
The order of the derivative

Definition at line 150 of file Attribute.h.

double Attribute::GetImaginary (  )  [inline]

Get the imaginary part the attribute's evaluation.

Parameters:
val The imaginary part

Definition at line 157 of file Attribute.h.

Referenced by AnalyticCoil::GetSensitivity().

Here is the caller graph for this function:

string Attribute::GetName (  )  const [inline]

Get the name of the attribute.

Returns:
The name of the attribute.

Definition at line 178 of file Attribute.h.

Referenced by EvalCompiledExpression(), EvalCompiledNLGExpression(), EvalExpression(), and SetMember().

Here is the caller graph for this function:

Prototype* Attribute::GetPrototype (  )  const [inline]

Get the pointer to the Prototype to which this attribute belongs.

Returns:
The pointer to the Prototype.

Definition at line 199 of file Attribute.h.

Referenced by EvalCompiledExpression(), EvalCompiledNLGExpression(), EvalExpression(), and SetMember().

Here is the caller graph for this function:

string Attribute::GetSymbol (  )  [inline]

Get the GiNaC symbol of this attribute.

return the GiNaC symbol

Definition at line 206 of file Attribute.h.

Referenced by EvalCompiledExpression(), and EvalCompiledNLGExpression().

Here is the caller graph for this function:

string Attribute::GetTypeID (  )  const [inline]

Get the type ID of the attribute.

Returns:
The type ID of the attribute.

Definition at line 185 of file Attribute.h.

Referenced by Module::AddAllDOMattributes(), EvalCompiledExpression(), EvalCompiledNLGExpression(), EvalExpression(), and SetMember().

Here is the caller graph for this function:

bool Attribute::IsComplex (  )  const [inline]

Check, if this attribute's evaluation is complex.

Returns:
true/false

Definition at line 164 of file Attribute.h.

bool Attribute::IsDynamic (  )  const [inline]

Check, if this attribute is dynamic. This is needed for exporting static XML Files of the Sequence.

Returns:
true/false

Definition at line 136 of file Attribute.h.

bool Attribute::IsObservable (  )  const [inline]

Check, if this attribute is observable by other attributes.

Returns:
true/false

Definition at line 121 of file Attribute.h.

Referenced by Module::AddAllDOMattributes(), AttachObserver(), AttachSubject(), Prototype::Observe(), and Prototype::Prepare().

Here is the caller graph for this function:

bool Attribute::IsPublic (  )  const [inline]

Check, if this attribute is public for manipulation through XML.

Returns:
true/false

Definition at line 107 of file Attribute.h.

Referenced by Module::AddAllDOMattributes().

Here is the caller graph for this function:

template<typename T >
bool Attribute::NewState ( const T &  val  )  [inline]

Check the state of the value represented by this attribute.

Parameters:
the value to ckeck return true, if the value is new

Definition at line 323 of file Attribute.h.

Referenced by Notify().

Here is the caller graph for this function:

template<typename T >
bool Attribute::Notify ( const T &  val  )  [inline]

Notify all observers.

Returns:
true, if notification took place.

Definition at line 297 of file Attribute.h.

References NewState().

Here is the call graph for this function:

void Attribute::SetDiff ( int  val = 0,
string  sym = "diff" 
) [inline]

Set the number of symbolic differentiations of the attribute's expression.

Parameters:
val The order of the derivative

Definition at line 171 of file Attribute.h.

void Attribute::SetDynamic ( bool  val  )  [inline]

Set this attribute to be dynamic.

Parameters:
val The state of being dynamic.

Definition at line 143 of file Attribute.h.

bool Attribute::SetMember ( string  expr,
const vector< Attribute * > &  obs_attribs,
bool  verbose = false 
)

Set the Prototype's private member represented by this attribute. The function performs the following tasks:

  • write a value to the Prototype's private member, in case of non-dynamic expressions
  • add all observed attributes which are necessary for GiNaC evaluation
  • set the GiNaC expression to calculate the value for the Prototype's private member
  • test once, if evaluation is possible.

Parameters:
expr the attribute value as it is read from XML
obs_attribs list of attributes observed by the Prototype
verbose if true, warnings will be dumped to stdout
Returns:
success/failure of operation

Definition at line 73 of file Attribute.cpp.

References AttachSubject(), EvalExpression(), get_symbol(), GetName(), Prototype::GetName(), GetPrototype(), GetTypeID(), and Prototype::ReplaceString().

Referenced by Prototype::Prepare(), AnalyticCoil::Prepare(), and GradPulse::PrepareNLGfield().

Here is the call graph for this function:

Here is the caller graph for this function:

void Attribute::SetObservable ( bool  val  )  [inline]

Set this attribute to be observable by other attributes.

Parameters:
val The state of being observable.

Definition at line 128 of file Attribute.h.

Referenced by Prototype::HideAttribute(), GradPulse::Prepare(), AnalyticCoil::Prepare(), and GradPulse::PrepareNLGfield().

Here is the caller graph for this function:

void Attribute::SetPublic ( bool  val  )  [inline]

Set this attribute to be public for manipulation through XML.

Parameters:
val The state of being public.

Definition at line 114 of file Attribute.h.

Referenced by Prototype::HideAttribute().

Here is the caller graph for this function:


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

Servicemeu