OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
MacroCmd Class Reference

#include <MacroCmd.h>

Inheritance diagram for MacroCmd:
Inheritance graph
Collaboration diagram for MacroCmd:
Collaboration graph

Public Member Functions

 MacroCmd ()
 
 MacroCmd (const std::string &name, MacroCmd *parent)
 
virtual ~MacroCmd ()
 
virtual void execute ()
 Execute the macro command. More...
 
virtual ObjectmakeInstance (const std::string &name, Statement &, const Parser *)
 Make a macro instance. More...
 
virtual ObjectmakeTemplate (const std::string &, TokenStream &, Statement &)
 Make a macro template. More...
 
virtual Macroclone (const std::string &name)
 Make clone. More...
 
virtual const std::string getCategory () const
 Return the object category as a string. More...
 
virtual bool shouldTrace () const
 Trace flag. More...
 
virtual bool shouldUpdate () const
 Update flag. More...
 
virtual void parseActuals (Statement &)
 Parse actual arguments. More...
 
virtual void parseFormals (Statement &)
 Parse formal arguments. More...
 
virtual bool canReplaceBy (Object *object)
 Test if replacement is allowed. More...
 
void copyAttributes (const Object &)
 Copy attributes from another object. More...
 
virtual AttributefindAttribute (const std::string &name)
 Find an attribute by name. More...
 
virtual const AttributefindAttribute (const std::string &name) const
 Find an attribute by name. More...
 
virtual void parse (Statement &)
 Parse the object. More...
 
virtual void parseShortcut (Statement &, bool eval=true)
 Parser for single-attribute commands. More...
 
virtual void print (std::ostream &) const
 Print the object. More...
 
virtual void printValue (std::ostream &) const
 
virtual void printHelp (std::ostream &) const
 Print help. More...
 
virtual void replace (Object *oldObject, Object *newObject)
 Replace references. More...
 
virtual void update ()
 Update this object. More...
 
bool isBuiltin () const
 True, if [b]this[/b] is a built-in object. More...
 
virtual bool isShared () const
 Shared flag. More...
 
virtual void setShared (bool)
 Set/reset shared flag. More...
 
void setDirty (bool)
 Set/reset the [b]modified[/b] flag. More...
 
bool isDirty () const
 True, if the [b]modified[/b] flag is set. More...
 
void setFlag (bool)
 Flag/unflag this object, e. g. to control output of objects for. More...
 
bool isFlagged () const
 True, if [b]this[/b] is flagged by setFlag(true). More...
 
const ObjectgetBaseObject () const
 Return the object's base type object. More...
 
const std::string & getOpalName () const
 Return object name. More...
 
ObjectgetParent () const
 Return parent pointer. More...
 
bool isTreeMember (const Object *subTree) const
 Test for tree membership. More...
 
void setOpalName (const std::string &name)
 Set object name. More...
 
void setParent (Object *)
 Set parent object. More...
 
void clear ()
 Clear the occurrence counter. More...
 
int increment ()
 Increment and return the occurrence counter. More...
 
int occurrenceCount ()
 Return the occurrence counter. More...
 
void registerReference (Invalidator *a)
 Register a reference to this object. More...
 
void unregisterReference (Invalidator *a)
 Unegister a reference to this object. More...
 
void registerOwnership (const AttributeHandler::OwnerType &itsClass) const
 
int addReference () const
 Increment reference count. More...
 
int removeReference () const
 Decrement the reference count. More...
 

Public Attributes

std::vector< AttributeitsAttr
 The object attributes. More...
 

Protected Attributes

std::vector< std::string > formals
 The formal argument list. More...
 
std::vector< std::vector< Token > > actuals
 The actual argument list. More...
 
bool builtin
 Built-in flag. More...
 
bool modified
 Dirty flag. More...
 
bool flagged
 Object flag. More...
 

Private Member Functions

 MacroCmd (const MacroCmd &)
 
void operator= (const MacroCmd &)
 

Private Attributes

std::shared_ptr< MacroStreambody
 
const ParseritsParser
 
ObjectitsParent
 
std::string itsName
 
std::string itsHelp
 
int occurrence
 
double timeStamp
 
std::set< Invalidator * > references
 
bool sharedFlag
 
int refCount
 

Detailed Description

Definition at line 35 of file MacroCmd.h.

Constructor & Destructor Documentation

◆ MacroCmd() [1/3]

MacroCmd::MacroCmd ( )

Definition at line 34 of file MacroCmd.cpp.

Referenced by makeInstance(), and makeTemplate().

◆ MacroCmd() [2/3]

MacroCmd::MacroCmd ( const std::string &  name,
MacroCmd parent 
)

Definition at line 42 of file MacroCmd.cpp.

References body.

◆ ~MacroCmd()

MacroCmd::~MacroCmd ( )
virtual

Definition at line 48 of file MacroCmd.cpp.

◆ MacroCmd() [3/3]

MacroCmd::MacroCmd ( const MacroCmd )
private

Member Function Documentation

◆ addReference()

int RCObject::addReference ( ) const
inlineinherited

Increment reference count.

Definition at line 83 of file RCObject.h.

References RCObject::refCount.

Referenced by Pointer< Object >::operator=(), and Pointer< Object >::unique().

◆ canReplaceBy()

bool Object::canReplaceBy ( Object object)
virtualinherited

Test if replacement is allowed.

Reimplemented in Table, Action, Element, Distribution, Beam, BoundaryGeometry, OpalFilter, BoolConstant, RealConstant, StringConstant, RealVariable, and RealVector.

Definition at line 48 of file Object.cpp.

Referenced by OpalData::define().

◆ clear()

void Object::clear ( )
inherited

Clear the occurrence counter.

Definition at line 339 of file Object.cpp.

References Object::occurrence.

◆ clone()

Macro * Macro::clone ( const std::string &  name)
virtualinherited

Make clone.

Implements Object.

Reimplemented in LineTemplate, and SequenceTemplate.

Definition at line 42 of file Macro.cpp.

References Object::getOpalName().

Here is the call graph for this function:

◆ copyAttributes()

void Object::copyAttributes ( const Object source)
inherited

Copy attributes from another object.

Definition at line 54 of file Object.cpp.

References Object::itsAttr.

Referenced by SequenceTemplate::makeInstance(), and LineTemplate::makeInstance().

◆ execute()

void MacroCmd::execute ( )
virtual

Execute the macro command.

Reimplemented from Object.

Definition at line 52 of file MacroCmd.cpp.

References body, itsParser, and Parser::run().

Here is the call graph for this function:

◆ findAttribute() [1/2]

◆ findAttribute() [2/2]

const Attribute * Object::findAttribute ( const std::string &  name) const
virtualinherited

Find an attribute by name.

Definition at line 72 of file Object.cpp.

References Object::itsAttr.

◆ getBaseObject()

const Object * Object::getBaseObject ( ) const
inherited

Return the object's base type object.

Definition at line 301 of file Object.cpp.

References Object::itsParent.

◆ getCategory()

const std::string Macro::getCategory ( ) const
virtualinherited

Return the object category as a string.

Implements Object.

Definition at line 49 of file Macro.cpp.

◆ getOpalName()

◆ getParent()

Object * Object::getParent ( ) const
inherited

Return parent pointer.

Definition at line 313 of file Object.cpp.

References Object::itsParent.

Referenced by OpalData::erase(), Object::print(), OpalElement::print(), OpalElement::registerOwnership(), and Object::registerOwnership().

◆ increment()

int Object::increment ( )
inherited

Increment and return the occurrence counter.

Definition at line 344 of file Object.cpp.

References Object::occurrence.

Referenced by Line::parse(), and Sequence::storeLine().

◆ isBuiltin()

bool Object::isBuiltin ( ) const
inherited

True, if [b]this[/b] is a built-in object.

Definition at line 266 of file Object.cpp.

References Object::builtin.

Referenced by OpalData::define(), and OpalData::getVariableNames().

◆ isDirty()

bool Object::isDirty ( ) const
inherited

True, if the [b]modified[/b] flag is set.

Definition at line 287 of file Object.cpp.

References Object::modified.

◆ isFlagged()

bool Object::isFlagged ( ) const
inherited

True, if [b]this[/b] is flagged by setFlag(true).

Definition at line 297 of file Object.cpp.

References Object::flagged.

◆ isShared()

bool Object::isShared ( ) const
virtualinherited

Shared flag.

Definition at line 271 of file Object.cpp.

References Object::sharedFlag.

Referenced by Sequence::print().

◆ isTreeMember()

bool Object::isTreeMember ( const Object subTree) const
inherited

Test for tree membership.

Definition at line 318 of file Object.cpp.

References Object::itsParent.

Referenced by Selector::handleElement(), and OpalParser::parseAssign().

◆ makeInstance()

Object * MacroCmd::makeInstance ( const std::string &  name,
Statement statement,
const Parser parser 
)
virtual

Make a macro instance.

Reimplemented from Object.

Definition at line 58 of file MacroCmd.cpp.

References Macro::actuals, body, Macro::formals, Token::getWord(), Token::isEOF(), Token::isWord(), itsParser, MacroCmd(), and Macro::parseActuals().

Here is the call graph for this function:

◆ makeTemplate()

Object * MacroCmd::makeTemplate ( const std::string &  name,
TokenStream ,
Statement statement 
)
virtual

Make a macro template.

Reimplemented from Object.

Definition at line 101 of file MacroCmd.cpp.

References Statement::atEnd(), body, Statement::delimiter(), Statement::getCurrent(), Token::isDel(), Statement::keyword(), MacroCmd(), Macro::parseFormals(), and PAssert.

Here is the call graph for this function:

◆ occurrenceCount()

int Object::occurrenceCount ( )
inherited

Return the occurrence counter.

Definition at line 349 of file Object.cpp.

References Object::occurrence.

◆ operator=()

void MacroCmd::operator= ( const MacroCmd )
private

◆ parse()

void Object::parse ( Statement stat)
virtualinherited

◆ parseActuals()

void Macro::parseActuals ( Statement stat)
virtualinherited

Parse actual arguments.

Definition at line 64 of file Macro.cpp.

References Macro::actuals, Statement::delimiter(), Statement::getCurrent(), and Token::isDel().

Referenced by SequenceTemplate::makeInstance(), makeInstance(), and LineTemplate::makeInstance().

Here is the call graph for this function:

◆ parseFormals()

void Macro::parseFormals ( Statement stat)
virtualinherited

Parse formal arguments.

Definition at line 100 of file Macro.cpp.

References Statement::delimiter(), Macro::formals, Expressions::parseDelimiter(), and Expressions::parseString().

Referenced by makeTemplate(), SequenceTemplate::parseTemplate(), and LineTemplate::parseTemplate().

Here is the call graph for this function:

◆ parseShortcut()

void Object::parseShortcut ( Statement stat,
bool  eval = true 
)
virtualinherited

Parser for single-attribute commands.

Definition at line 127 of file Object.cpp.

References Statement::delimiter(), Object::findAttribute(), Object::getOpalName(), Statement::mark(), and Statement::word().

Referenced by Call::parse(), Echo::parse(), Help::parse(), PSystem::parse(), System::parse(), Title::parse(), and Value::parse().

Here is the call graph for this function:

◆ print()

◆ printHelp()

void Object::printHelp ( std::ostream &  ) const
virtualinherited

Print help.

Definition at line 199 of file Object.cpp.

References endl(), gmsg, Object::itsAttr, Object::itsHelp, and ippl::max().

Referenced by Help::execute().

Here is the call graph for this function:

◆ printValue()

void Object::printValue ( std::ostream &  os) const
inlinevirtualinherited

Reimplemented in BoolConstant, RealConstant, RealVariable, RealVector, and StringConstant.

Definition at line 280 of file Object.h.

References Object::print().

Here is the call graph for this function:

◆ registerOwnership()

◆ registerReference()

void Object::registerReference ( Invalidator a)
inherited

Register a reference to this object.

Definition at line 180 of file Object.cpp.

References Object::references.

◆ removeReference()

int RCObject::removeReference ( ) const
inlineinherited

Decrement the reference count.

Definition at line 88 of file RCObject.h.

References RCObject::refCount.

◆ replace()

void Object::replace ( Object oldObject,
Object newObject 
)
virtualinherited

Replace references.

Reimplemented in Line, and Sequence.

Definition at line 256 of file Object.cpp.

◆ setDirty()

void Object::setDirty ( bool  dirty)
inherited

Set/reset the [b]modified[/b] flag.

Definition at line 281 of file Object.cpp.

References Object::modified.

Referenced by OpalData::define(), OpalData::makeDirty(), and RealVariable::RealVariable().

◆ setFlag()

void Object::setFlag ( bool  flag)
inherited

Flag/unflag this object, e. g. to control output of objects for.

Definition at line 292 of file Object.cpp.

References Object::flagged.

◆ setOpalName()

void Object::setOpalName ( const std::string &  name)
inherited

Set object name.

Definition at line 329 of file Object.cpp.

References Object::itsName.

Referenced by Beam::update(), BoundaryGeometry::update(), and OpalFilter::update().

◆ setParent()

void Object::setParent ( Object parent)
inherited

Set parent object.

Definition at line 334 of file Object.cpp.

References Object::itsParent.

Referenced by OpalData::erase().

◆ setShared()

void Object::setShared ( bool  flag)
virtualinherited

Set/reset shared flag.

Reimplemented in Element.

Definition at line 276 of file Object.cpp.

References Object::sharedFlag.

Referenced by OpalParser::parseDefine(), and Element::setShared().

◆ shouldTrace()

bool Macro::shouldTrace ( ) const
virtualinherited

Trace flag.

Implements Object.

Definition at line 54 of file Macro.cpp.

◆ shouldUpdate()

bool Macro::shouldUpdate ( ) const
virtualinherited

Update flag.

Implements Object.

Definition at line 59 of file Macro.cpp.

◆ unregisterReference()

void Object::unregisterReference ( Invalidator a)
inherited

Unegister a reference to this object.

Definition at line 185 of file Object.cpp.

References Object::references.

◆ update()

Member Data Documentation

◆ actuals

std::vector<std::vector < Token > > Macro::actuals
protectedinherited

The actual argument list.

Definition at line 82 of file Macro.h.

Referenced by SequenceTemplate::makeInstance(), makeInstance(), LineTemplate::makeInstance(), and Macro::parseActuals().

◆ body

std::shared_ptr<MacroStream> MacroCmd::body
private

Definition at line 64 of file MacroCmd.h.

Referenced by execute(), MacroCmd(), makeInstance(), and makeTemplate().

◆ builtin

◆ flagged

bool Object::flagged
protectedinherited

Object flag.

Definition at line 242 of file Object.h.

Referenced by Object::isFlagged(), Object::Object(), and Object::setFlag().

◆ formals

std::vector<std::string> Macro::formals
protectedinherited

The formal argument list.

Definition at line 78 of file Macro.h.

Referenced by SequenceTemplate::makeInstance(), makeInstance(), LineTemplate::makeInstance(), and Macro::parseFormals().

◆ itsAttr

std::vector<Attribute> Object::itsAttr
inherited

The object attributes.

Definition at line 216 of file Object.h.

Referenced by Beam::Beam(), BoolConstant::BoolConstant(), BoundaryGeometry::BoundaryGeometry(), DumpEMFields::buildGrid(), DumpFields::buildGrid(), Call::Call(), FieldSolverCmd::constructBCHandler(), Object::copyAttributes(), Distribution::Distribution(), DumpEMFields::DumpEMFields(), DumpFields::DumpFields(), Echo::Echo(), Call::execute(), Echo::execute(), Help::execute(), Option::execute(), PSystem::execute(), Select::execute(), System::execute(), Title::execute(), Value::execute(), Beam::execute(), TrackCmd::execute(), TrackRun::execute(), FieldSolverCmd::FieldSolverCmd(), Object::findAttribute(), BoundaryGeometry::getA(), OpalElement::getApert(), BoundaryGeometry::getB(), BoolConstant::getBool(), FieldSolverCmd::getBoxIncr(), BoundaryGeometry::getC(), Beam::getCharge(), Beam::getCurrent(), FieldSolverCmd::getDomDec(), TrackCmd::getDT(), TrackCmd::getDTAU(), TrackCmd::getDTSCINIT(), BoundaryGeometry::getFilename(), Beam::getFrequency(), BoundaryGeometry::getL1(), BoundaryGeometry::getL2(), BoundaryGeometry::getLength(), OpalElement::getLength(), Line::getLength(), Sequence::getLength(), Beam::getMass(), TrackCmd::getMaxSteps(), Beam::getNumberOfParticles(), FieldSolverCmd::getNX(), FieldSolverCmd::getNY(), FieldSolverCmd::getNZ(), Beam::getParticleName(), RealConstant::getReal(), RealVariable::getReal(), RealVector::getRealComponent(), Sequence::getReference(), BoundaryGeometry::getS(), TrackCmd::getStepsPerTurn(), StringConstant::getString(), TrackCmd::getT0(), TrackCmd::getTimeIntegrator(), BoundaryGeometry::getTopology(), FieldSolverCmd::getType(), TrackCmd::getZStart(), TrackCmd::getZStop(), Help::Help(), BoundaryGeometry::initialize(), OpalFilter::initOpalFilter(), Line::Line(), OpalCavity::OpalCavity(), OpalDrift::OpalDrift(), OpalElement::OpalElement(), OpalFilter::OpalFilter(), OpalOffset::OpalGlobalCartesianOffset::OpalGlobalCartesianOffset(), OpalOffset::OpalGlobalCylindricalOffset::OpalGlobalCylindricalOffset(), OpalOffset::OpalLocalCartesianOffset::OpalLocalCartesianOffset(), OpalOffset::OpalLocalCylindricalOffset::OpalLocalCylindricalOffset(), OpalMultipole::OpalMultipole(), OpalMultipoleT::OpalMultipoleT(), OpalProbe::OpalProbe(), OpalRingDefinition::OpalRingDefinition(), OpalSolenoid::OpalSolenoid(), OpalTravelingWave::OpalTravelingWave(), OpalVacuum::OpalVacuum(), OpalVerticalFFAMagnet::OpalVerticalFFAMagnet(), Option::Option(), Sequence::parse(), Line::parse(), DumpEMFields::parseCoordinateSystem(), TrackRun::print(), Object::print(), Sequence::print(), BoolConstant::print(), RealConstant::print(), RealVariable::print(), RealVector::print(), StringConstant::print(), DumpEMFields::print(), DumpFields::print(), Beam::print(), OpalFilter::print(), Object::printHelp(), BoundaryGeometry::printInfo(), FieldSolverCmd::printInfo(), BoolConstant::printValue(), RealConstant::printValue(), RealVariable::printValue(), RealVector::printValue(), StringConstant::printValue(), PSystem::PSystem(), RealConstant::RealConstant(), RealVariable::RealVariable(), RealVector::RealVector(), OpalElement::registerOwnership(), Object::registerOwnership(), Select::Select(), Select::select(), Sequence::Sequence(), Distribution::setDistParametersFlatTop(), Distribution::setDistParametersMultiVariateGauss(), Distribution::setDistType(), FieldSolverCmd::setNX(), FieldSolverCmd::setNY(), FieldSolverCmd::setNZ(), TrackRun::setRunMethod(), Distribution::setSigmaP_m(), Distribution::setSigmaR_m(), TrackRun::setupBoundaryGeometry(), StringConstant::StringConstant(), System::System(), Title::Title(), TrackCmd::TrackCmd(), TrackRun::TrackRun(), OpalCavity::update(), OpalDrift::update(), OpalElement::update(), OpalMonitor::update(), OpalMultipole::update(), OpalMultipoleT::update(), OpalOffset::OpalGlobalCartesianOffset::update(), OpalOffset::OpalGlobalCylindricalOffset::update(), OpalOffset::OpalLocalCartesianOffset::update(), OpalOffset::OpalLocalCylindricalOffset::update(), OpalProbe::update(), OpalRingDefinition::update(), OpalSolenoid::update(), OpalTravelingWave::update(), OpalVacuum::update(), OpalVerticalFFAMagnet::update(), Beam::update(), FieldSolverCmd::update(), Option::update(), OpalElement::updateUnknown(), ValueDefinition::value(), and Value::Value().

◆ itsHelp

std::string Object::itsHelp
privateinherited

Definition at line 258 of file Object.h.

Referenced by Object::printHelp().

◆ itsName

std::string Object::itsName
privateinherited

Definition at line 255 of file Object.h.

Referenced by Object::getOpalName(), and Object::setOpalName().

◆ itsParent

Object* Object::itsParent
privateinherited

◆ itsParser

const Parser* MacroCmd::itsParser
private

Definition at line 67 of file MacroCmd.h.

Referenced by execute(), and makeInstance().

◆ modified

bool Object::modified
protectedinherited

Dirty flag.

Definition at line 238 of file Object.h.

Referenced by Object::isDirty(), Object::Object(), and Object::setDirty().

◆ occurrence

int Object::occurrence
privateinherited

Definition at line 261 of file Object.h.

Referenced by Object::clear(), Object::increment(), and Object::occurrenceCount().

◆ refCount

int RCObject::refCount
mutableprivateinherited

◆ references

std::set<Invalidator *> Object::references
privateinherited

◆ sharedFlag

bool Object::sharedFlag
privateinherited

Definition at line 271 of file Object.h.

Referenced by Object::isShared(), and Object::setShared().

◆ timeStamp

double Object::timeStamp
privateinherited

Definition at line 264 of file Object.h.


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