OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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 
19 #include "Attributes/Reference.h"
22 #include "Expressions/SRefAttr.h"
23 #include "Expressions/SValue.h"
25 
26 using namespace Expressions;
27 
28 
29 // Class Reference
30 // ------------------------------------------------------------------------
31 
32 namespace 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 };
void set(AttributeBase *newBase)
Define new value.
Definition: Attribute.cpp:137
virtual const std::string & getType() const
Return attribute type string ``reference&#39;&#39;.
Definition: Reference.cpp:43
SRefAttr< double > * parseReference(Statement &)
Parse variable reference.
An attribute defined as a reference to a scalar.
Definition: Expressions.h:248
A representation of an Object attribute.
Definition: Attribute.h:55
Interface for statements.
Definition: Statement.h:38
Abstract base class for attribute parsers.
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
Definition: Reference.cpp:49
Object attribute with a constant scalar value.
Definition: SValue.h:34
const std::string name