JEMRIS  2.8.1
open-source MRI simulations
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
Prototype Class Referenceabstract

Prototype super class. More...

#include <Prototype.h>

+ Inheritance diagram for Prototype:
+ Collaboration diagram for Prototype:

Public Member Functions

 Prototype ()
 Constructor. More...
 
virtual ~Prototype ()
 Default destructor. More...
 
 Prototype (const Prototype &)
 Default copy constructor. More...
 
virtual PrototypeGetParent ()
 Get Parent. More...
 
virtual PrototypeClone () const =0
 Clone a prototype. More...
 
virtual bool Prepare (PrepareMode mode)=0
 Prepare this pulse. More...
 
bool IsPrepared ()
 Check if the Prototype is prepared. More...
 
virtual void Initialize (DOMNode *conf)=0
 Initialise this prototype. More...
 
void SetName (string name)
 Set the name of this module. More...
 
DOMNode * GetNode ()
 Get the DOMNode of this module. More...
 
void SetNode (DOMNode *node)
 Set the DOMNode of this module. More...
 
string GetClassType ()
 Get the class type of this prototype. More...
 
Type GetType ()
 Get the module type of this module. More...
 
string GetDOMattribute (const string attribute)
 Get attribute value from the DOMNode. More...
 
bool HasDOMattribute (const string attribute)
 Check, if attribute exists in DOM node of this module. More...
 
AttributeGetAttribute (string name)
 Get an Attribute. More...
 
void CopyObservers (Attribute *a1, Attribute *a2)
 Copy observers from one attribute to another. More...
 
bool HasAttribute (string name)
 Check if an attribute exist. More...
 
void HideAttribute (string attrib, bool observable=true)
 Hide an attribute. More...
 
virtual PrototypeGetPrototypeByAttributeValue (string name, string attrib)
 Get a Prototype by value of an attribute. More...
 
string GetName ()
 Get the name of this module. More...
 
bool Observe (Attribute *attrib, string prot_name, string attrib_name, bool verbose)
 Set up the list of observations. More...
 
bool Observe (Attribute *attrib, string prot_name, string attrib_name, string attrib_keyword, bool verbose)
 
template<typename T >
bool Notify (const T &val)
 Notify all observers of an attribute. More...
 
template<typename T >
bool NewState (const T &val)
 Check the state of an attribute. More...
 
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. More...
 

Static Public Member Functions

static bool ReplaceString (string &str, const string &s1, const string &s2)
 A global sub-string replacer. More...
 
static bool ReplaceSymbolString (string &str, const string &s1, const string &s2)
 A global sub-string replacer which replaces only complete symbol strings.
 
static vector< string > Tokenize (const string &str, const string &delimiters=",")
 A global string tokenizer. More...
 

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.
 
vector< string > m_obs_attrib_keyword
 Vector of user-defined Attribute names.
 

Detailed Description

Prototype super class.

Constructor & Destructor Documentation

Prototype::Prototype ( )
inline

Constructor.

Default constructor

virtual Prototype::~Prototype ( )
inlinevirtual

Default destructor.

Delete my attributes

Prototype::Prototype ( const Prototype )
inline

Default copy constructor.

Default copy constructor.

Member Function Documentation

virtual Prototype* Prototype::Clone ( ) const
pure virtual
void Prototype::CopyObservers ( Attribute a1,
Attribute a2 
)

Copy observers from one attribute to another.

Parameters
a1source attribute (copy from here)
a1target attribute (copy to here)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Attribute * Prototype::GetAttribute ( string  name)

Get an Attribute.

Parameters
nameThe name of the attribute.
Returns
The Attribute.

+ Here is the caller graph for this function:

string Prototype::GetClassType ( )
inline

Get the class type of this prototype.

Returns
The tag name of the DOMNode.

+ 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
attributeThe attribute of the DOMNode corresponding to this Module.
Returns
The value of the attribute

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string Prototype::GetName ( )
inline

Get the name of this module.

Returns
The value of the private member m_name

+ Here is the call graph for this function:

+ 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

+ Here is the caller graph for this function:

virtual Prototype* Prototype::GetParent ( )
inlinevirtual

Get Parent.

Returns
Parent module.

Reimplemented in Module.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual Prototype* Prototype::GetPrototypeByAttributeValue ( string  name,
string  attrib 
)
inlinevirtual

Get a Prototype by value of an attribute.

Parameters
nameAttribute name
attribAttribute value
Returns
Found Prototype

Reimplemented in Module.

+ 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

+ 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

+ Here is the caller graph for this function:

bool Prototype::HasAttribute ( string  name)
inline

Check if an attribute exist.

Parameters
nameThe name of the attribute
Returns
Success/Failure of operation.

+ 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
attributeThe attribute of the DOMNode corresponding to this Module.
Returns
True, if attribute exists in DOM (XML)

+ 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
attribName of the attribute to hide
observableKeep this attribute still observable? (default: true)

+ 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
confDOMNode with configuration

Implemented in Coil, and Module.

+ Here is the caller graph for this function:

bool Prototype::IsPrepared ( )
inline

Check if the Prototype is prepared.

Returns
True, if prepared.

+ Here is the call graph for this function:

+ 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
privatemember variable.
Returns
true, if member has changed

+ 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
valmember variable.
Returns
true, if member has changed

+ 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
attribThe observer (An Attribute of this Prototype)
prot_nameName of the Prototype which holds the Attribute to observe
attrib_nameName of the Attribute to observe
verboseIf true, dump possible warnings to stdout
Returns
success/failure of operation

+ 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
modeSets the preparation mode, one of enum PrepareMode {PREP_INIT,PREP_VERBOSE,PREP_UPDATE}.
Returns
Success

Implemented in Coil, Module, AnalyticCoil, ExternalCoil, BiotSavartLoop, DelayAtomicSequence, Pulse, Container, RFPulse, ContainerSequence, EddyPulse, Parameters, AtomicSequence, GradPulse, TriangleGradPulse, AnalyticRFPulse, ConcatSequence, ExternalGradPulse, Sequence, EmptyPulse, ExternalRFPulse, HardRFPulse, SpiralGradPulse, TrapGradPulse, AnalyticGradPulse, GaussianRFPulse, SechRFPulse, SincRFPulse, and ConstantGradPulse.

+ 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
strThe string to change.
s1The sub-string to be replaced.
s2The sub-string to be inserted instead.
Returns
True, if replacing took place at least once (s1 was in str).

+ Here is the caller graph for this function:

void Prototype::SetName ( string  name)

Set the name of this module.

Parameters
nameNew name of this module

+ Here is the caller graph for this function:

void Prototype::SetNode ( DOMNode *  node)
inline

Set the DOMNode of this module.

Parameters
nodeThe new DOMNode

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

A global string tokenizer.

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

+ Here is the caller graph for this function:


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

-- last change 17.06.2016 | Tony Stoecker | Imprint --