link to homepage

Institute for Neuroscience and Medicine

Navigation and service


API documentation

Prototype super class. More...

#include <Prototype.h>

Inheritance diagram for Prototype:

List of all members.

Public Member Functions

 Prototype ()
 Constructor.
virtual ~Prototype ()
 Default destructor.
 Prototype (const Prototype &)
virtual PrototypeGetParent ()
 Get Parent.
virtual PrototypeClone () const =0
 Clone a prototype.
virtual bool Prepare (PrepareMode mode)=0
 Prepare this pulse.
bool IsPrepared ()
 Check if the Prototype is prepared.
virtual void Initialize (DOMNode *conf)=0
 Initialise this prototype.
void SetName (string name)
 Set the name of this module.
DOMNode * GetNode ()
 Get the DOMNode of this module.
void SetNode (DOMNode *node)
 Set the DOMNode of this module.
string GetClassType ()
 Get the class type of this prototype.
Type GetType ()
 Get the module type of this module.
string GetDOMattribute (const string attribute)
 Get attribute value from the DOMNode.
bool HasDOMattribute (const string attribute)
 Check, if attribute exists in DOM node of this module.
AttributeGetAttribute (string name)
 Get an Attribute.
bool HasAttribute (string name)
 Check if an attribute exist.
void HideAttribute (string attrib, bool observable=true)
 Hide an attribute.
virtual PrototypeGetPrototypeByAttributeValue (string name, string attrib)
 Get a Prototype by value of an attribute.
string GetName ()
 Get the name of this module.
bool Observe (Attribute *attrib, string prot_name, string attrib_name, bool verbose)
 Set up the list of observations.
template<typename T >
bool Notify (const T &val)
 Notify all observers of an attribute.
template<typename T >
bool NewState (const T &val)
 Check the state of an attribute.
vector< double > * GetVector ()
 Each Prototype has a double vector as a private member, which values can be filled through XML and accessed from attributes within the same Prototype.

Static Public Member Functions

static bool ReplaceString (string &str, const string &s1, const string &s2)
 A global sub-string replacer.
static vector< string > Tokenize (const string &str, const string &delimiters=",")
 A global string tokenizer.

Protected Attributes

bool m_aux
 auxiliary helper variable for debugging purposes
bool m_prepared
 True, after the first call to Prepare.
string m_name
 Name of this Prototype.
DOMNode * m_node
 The node configuring this Module.
Type m_type
 The type of the module: one of MOD_PULSE, MOD_ATOM, MOD_CONCAT.
vector< double > m_vector
 A vector which elements are accessible through loop counters.
map< string, Attribute * > m_attributes
 Map to connect a keyword with an Attribute.
vector< Attribute * > m_obs_attribs
 Vector of observed Attributes.

Detailed Description

Prototype super class.

Definition at line 68 of file Prototype.h.


Constructor & Destructor Documentation

Prototype::Prototype (  )  [inline]

Constructor.

Default constructor

Definition at line 77 of file Prototype.h.

References m_prepared.

virtual Prototype::~Prototype (  )  [inline, virtual]

Default destructor.

Default destrcutor

Definition at line 84 of file Prototype.h.

Prototype::Prototype ( const Prototype  )  [inline]

Default copy constructor.

Definition at line 91 of file Prototype.h.


Member Function Documentation

virtual Prototype* Prototype::Clone (  )  const [pure virtual]

Clone a prototype.

Create and recieve a Clone of an unprepared prototype.

Implemented in AnalyticCoil, AnalyticGradPulse, AtomicSequence, BiotSavartLoop, Coil, ConcatSequence, ConstantGradPulse, DelayAtomicSequence, EmptyPulse, ExternalCoil, ExternalGradPulse, IdealCoil, Module, Parameters, SpiralGradPulse, TrapGradPulse, and TriangleGradPulse.

Referenced by PrototypeFactory::Clone().

Here is the caller graph for this function:

Attribute * Prototype::GetAttribute ( string  name  ) 
string Prototype::GetClassType (  )  [inline]

Get the class type of this prototype.

Returns:
The tag name of the DOMNode.

Definition at line 178 of file Prototype.h.

References GetNode().

Referenced by Module::DumpTree(), and SequenceTree::SerializeModules().

Here is the call graph for this function:

Here is the caller graph for this function:

string Prototype::GetDOMattribute ( const string  attribute  )  [inline]

Get attribute value from the DOMNode.

Parameters:
attribute The attribute of the DOMNode corresponding to this Module.
Returns:
The value of the attribute

Definition at line 194 of file Prototype.h.

References m_node.

Referenced by GradPulse::GetInfo(), EmptyPulse::GetInfo(), AnalyticRFPulse::GetInfo(), AnalyticGradPulse::GetInfo(), HasDOMattribute(), TriangleGradPulse::Prepare(), Prepare(), AnalyticRFPulse::Prepare(), AnalyticGradPulse::Prepare(), AnalyticCoil::Prepare(), and GradPulse::PrepareNLGfield().

Here is the caller graph for this function:

DOMNode* Prototype::GetNode (  )  [inline]

Get the DOMNode of this module.

Returns:
The value of the private member m_node

Definition at line 145 of file Prototype.h.

References m_node.

Referenced by GetClassType(), Module::InsertChild(), SequenceTree::SerializeModules(), and Module::WriteStaticXML().

Here is the caller graph for this function:

virtual Prototype* Prototype::GetParent (  )  [inline, virtual]

Get Parent.

Returns:
Parent module.

Reimplemented in Module.

Definition at line 98 of file Prototype.h.

virtual Prototype* Prototype::GetPrototypeByAttributeValue ( string  name,
string  attrib 
) [inline, virtual]

Get a Prototype by value of an attribute.

Parameters:
name Attribute name
attrib Attribute value
Returns:
Found Prototype

Reimplemented in Module.

Definition at line 241 of file Prototype.h.

Referenced by Observe().

Here is the caller graph for this function:

Type Prototype::GetType (  )  [inline]

Get the module type of this module.

Returns:
The module type: one of MOD_PULSE, MOD_ATOM, MOD_CONCAT

Definition at line 185 of file Prototype.h.

References m_type.

Referenced by Module::DumpTree(), Sequence::GetNumOfADCs(), SequenceTree::SerializeModules(), and Sequence::WriteSeqFile().

Here is the caller graph for this function:

vector<double>* Prototype::GetVector (  )  [inline]

Each Prototype has a double vector as a private member, which values can be filled through XML and accessed from attributes within the same Prototype.

Returns:
Pointer to the double vector of this Prototype

Definition at line 301 of file Prototype.h.

Referenced by Attribute::EvalExpression().

Here is the caller graph for this function:

bool Prototype::HasAttribute ( string  name  )  [inline]

Check if an attribute exist.

Parameters:
key The name of the attribute
Returns:
Success/Failure of operation.

Definition at line 219 of file Prototype.h.

References GetAttribute().

Here is the call graph for this function:

bool Prototype::HasDOMattribute ( const string  attribute  )  [inline]

Check, if attribute exists in DOM node of this module.

Parameters:
attribute The attribute of the DOMNode corresponding to this Module.
Returns:
True, if attribute exists in DOM (XML)

Definition at line 202 of file Prototype.h.

References GetDOMattribute().

Referenced by Module::AddDOMattribute(), GradPulse::GetInfo(), EmptyPulse::GetInfo(), AnalyticRFPulse::GetInfo(), AnalyticGradPulse::GetInfo(), AtomicSequence::GetValue(), TriangleGradPulse::Prepare(), TrapGradPulse::Prepare(), SpiralGradPulse::Prepare(), GradPulse::Prepare(), AnalyticRFPulse::Prepare(), and AnalyticGradPulse::Prepare().

Here is the call graph for this function:

Here is the caller graph for this function:

void Prototype::HideAttribute ( string  attrib,
bool  observable = true 
)

Hide an attribute.

Attributes, which were declared with the ATTRIBUTE command in a base class will be declared as invisible, i.e. they can not be set through XML. This method has to called in the particular Prepare function of a method, however, after the base class Prepare call.

Parameters:
attrib Name of the attribute to hide
observable Keep this attribute still observable? (default: true)

Definition at line 84 of file Prototype.cpp.

References GetAttribute(), Attribute::SetObservable(), and Attribute::SetPublic().

Referenced by TriangleGradPulse::Prepare(), SincRFPulse::Prepare(), Sequence::Prepare(), SechRFPulse::Prepare(), RFPulse::Prepare(), Parameters::Prepare(), HardRFPulse::Prepare(), ExternalRFPulse::Prepare(), ExternalGradPulse::Prepare(), DelayAtomicSequence::Prepare(), ConstantGradPulse::Prepare(), AnalyticRFPulse::Prepare(), and AnalyticGradPulse::Prepare().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Prototype::Initialize ( DOMNode *  conf  )  [pure virtual]

Initialise this prototype.

Parameters:
conf DOMNode with configuration

Implemented in Coil, and Module.

bool Prototype::IsPrepared (  )  [inline]

Check if the Prototype is prepared.

Returns:
True, if prepared.

Definition at line 123 of file Prototype.h.

References m_prepared.

Referenced by GradPulse::GradPulse(), and Observe().

Here is the caller graph for this function:

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

Check the state of an attribute.

Parameters:
private member variable.
Returns:
true, if member has changed

Definition at line 286 of file Prototype.h.

References m_attributes.

Referenced by ConcatSequence::begin().

Here is the caller graph for this function:

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

Notify all observers of an attribute.

Parameters:
private member variable.
Returns:
true, if member has changed

Definition at line 271 of file Prototype.h.

References m_attributes.

Referenced by ConcatSequence::GetDuration(), AtomicSequence::GetDuration(), and ConcatSequence::SetRepCounter().

Here is the caller graph for this function:

bool Prototype::Observe ( Attribute attrib,
string  prot_name,
string  attrib_name,
bool  verbose 
)

Set up the list of observations.

This function creates an Attribute list for all observations from this Prototype. It further attaches the current attribute to the observer list of the observed attributes.

Parameters:
attrib The observer (An Attribute of this Prototype)
prot_name Name of the Prototype which holds the Attribute to observe
attrib_name Name of the Attribute to observe
verbose If true, dump possible warnings to stdout
Returns:
success/failure of operation

Definition at line 95 of file Prototype.cpp.

References Attribute::AttachSubject(), GetAttribute(), GetName(), GetPrototypeByAttributeValue(), Attribute::IsObservable(), IsPrepared(), m_obs_attribs, and Prepare().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool Prototype::Prepare ( PrepareMode  mode  )  [pure virtual]

Prepare this pulse.

Called many times when root node prepares. First time not verbose. Successors must overload this method.

Parameters:
mode Sets the preparation mode, one of enum PrepareMode {PREP_INIT,PREP_VERBOSE,PREP_UPDATE}.
Returns:
Success

Implemented in AnalyticCoil, AnalyticGradPulse, AtomicSequence, BiotSavartLoop, Coil, ConcatSequence, ConstantGradPulse, DelayAtomicSequence, EmptyPulse, ExternalCoil, ExternalGradPulse, GradPulse, Module, Parameters, Pulse, Sequence, SpiralGradPulse, TrapGradPulse, and TriangleGradPulse.

Definition at line 126 of file Prototype.cpp.

References GetDOMattribute(), GetName(), Attribute::IsObservable(), m_attributes, m_aux, m_name, m_obs_attribs, m_prepared, m_vector, Observe(), Attribute::SetMember(), and Tokenize().

Referenced by Observe().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Prototype::ReplaceString ( string &  str,
const string &  s1,
const string &  s2 
) [static]

A global sub-string replacer.

Parameters:
str The string to change.
s1 The sub-string to be replaced.
s2 The sub-string to be inserted instead.
Returns:
True, if replacing took place at least once (s1 was in str).

Definition at line 37 of file Prototype.cpp.

Referenced by Attribute::EvalCompiledExpression(), Attribute::EvalExpression(), AnalyticCoil::Prepare(), GradPulse::PrepareNLGfield(), and Attribute::SetMember().

Here is the caller graph for this function:

void Prototype::SetName ( string  name  ) 

Set the name of this module.

Parameters:
name New name of this module

Definition at line 28 of file Prototype.cpp.

References m_name, and m_node.

Referenced by Module::Initialize(), Coil::Initialize(), and DelayAtomicSequence::Prepare().

Here is the caller graph for this function:

void Prototype::SetNode ( DOMNode *  node  )  [inline]

Set the DOMNode of this module.

Parameters:
node The new DOMNode

Definition at line 152 of file Prototype.h.

References m_node.

Referenced by Module::WriteStaticXML().

Here is the caller graph for this function:

vector< string > Prototype::Tokenize ( const string &  str,
const string &  delimiters = "," 
) [static]

A global string tokenizer.

Parameters:
str The string to tokenize.
delimiters The delimiters to split the string.
Returns:
The vector of tokenized sub-strings.

Definition at line 56 of file Prototype.cpp.

Referenced by Prepare().

Here is the caller graph for this function:


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

Servicemeu