OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Reference.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: Reference.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class Reference:
10// A class used to parse reference attributes.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:36 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
23#include "Expressions/SValue.h"
25
26using namespace Expressions;
27
28
29// Class Reference
30// ------------------------------------------------------------------------
31
32namespace Attributes {
33
34 Reference::Reference(const std::string &name, const std::string &help):
35 AttributeHandler(name, help, 0)
36 {}
37
38
40 {}
41
42
43 const std::string &Reference::getType() const {
44 static const std::string type("reference");
45 return type;
46 }
47
48
49 void Reference::parse(Attribute &attr, Statement &stat, bool) const {
50 attr.set(new SValue < SRefAttr<double> > (*parseReference(stat)));
51 }
52
53};
const std::string name
Representation objects and parsers for attribute expressions.
Definition: Expressions.h:64
SRefAttr< double > * parseReference(Statement &)
Parse variable reference.
A collection of routines to construct object Attributes and retrieve.
Definition: Attributes.cpp:85
boost::function< boost::tuple< double, bool >(arguments_t)> type
Definition: function.hpp:21
A representation of an Object attribute.
Definition: Attribute.h:52
void set(AttributeBase *newBase)
Define new value.
Definition: Attribute.cpp:139
Abstract base class for attribute parsers.
An attribute defined as a reference to a scalar.
Definition: SRefAttr.h:48
Reference(const std::string &name, const std::string &help)
Constructor.
Definition: Reference.cpp:34
virtual const std::string & getType() const
Return attribute type string `‘reference’'.
Definition: Reference.cpp:43
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
Definition: Reference.cpp:49
Interface for statements.
Definition: Statement.h:38
Object attribute with a constant scalar value.
Definition: SValue.h:34