Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit e22e0f18 authored by ext-calvo_p's avatar ext-calvo_p
Browse files

Merge branch '795-regression-test-broken-string-constant-duplicated' into 'master'

Resolve "Regression test broken: string constant duplicated"

Closes #795

See merge request OPAL/src!651
parents 23558441 5673a9d4
No related branches found
No related tags found
1 merge request!651Resolve "Regression test broken: string constant duplicated"
......@@ -2,7 +2,7 @@
// Class StringConstant
// The STRING CONSTANT definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// Copyright (c) 2000 - 2023, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
......@@ -36,7 +36,7 @@ StringConstant::StringConstant():
registerOwnership(AttributeHandler::STATEMENT);
OpalData *opal = OpalData::getInstance();
OpalData* opal = OpalData::getInstance();
opal->create(new StringConstant("GITREVISION", this, Util::getGitRevision()));
// NOTE: Strings that contain a hyphen can't be written without quotes and
......@@ -54,6 +54,7 @@ StringConstant::StringConstant():
CREATE_STRINGCONSTANT("STANDING");
CREATE_STRINGCONSTANT("TEMPORAL");
CREATE_STRINGCONSTANT("SPATIAL");
// Beam / PARTICLE
CREATE_STRINGCONSTANT("ELECTRON");
CREATE_STRINGCONSTANT("PROTON");
......@@ -67,6 +68,7 @@ StringConstant::StringConstant():
CREATE_STRINGCONSTANT("XENON");
CREATE_STRINGCONSTANT("H2P");
CREATE_STRINGCONSTANT("ALPHA");
// Distribution / TYPE
CREATE_STRINGCONSTANT("FROMFILE");
CREATE_STRINGCONSTANT("GAUSS");
......@@ -127,11 +129,11 @@ StringConstant::StringConstant():
// OutputPlane / PLACEMENT_STYLE
CREATE_STRINGCONSTANT("CENTRE_NORMAL");
CREATE_STRINGCONSTANT("PROBE");
// additionally: PROBE;
// OutputPlane / ALGORITHM
CREATE_STRINGCONSTANT("INTERPOLATION");
// CREATE_STRINGCONSTANT("RK4");
// additionally: RK4;
// ParticleMatterInteraction / TYPE
CREATE_STRINGCONSTANT("SCATTERING");
......@@ -274,44 +276,41 @@ StringConstant::StringConstant():
CREATE_STRINGCONSTANT("CYLINDRICAL");
}
StringConstant::StringConstant(const std::string &name, StringConstant *parent):
ValueDefinition(name, parent)
{}
StringConstant::StringConstant(const std::string& name,
StringConstant* parent)
: ValueDefinition(name, parent) {
}
StringConstant::StringConstant(const std::string& name,
StringConstant* parent,
const std::string& value)
: ValueDefinition(name, parent) {
StringConstant::StringConstant(const std::string &name, StringConstant *parent, const std::string &value):
ValueDefinition(name, parent)
{
Attributes::setString(itsAttr[0], value);
itsAttr[0].setReadOnly(true);
builtin = true;
}
StringConstant::~StringConstant()
{}
bool StringConstant::canReplaceBy(Object *) {
bool StringConstant::canReplaceBy(Object*) {
return false;
}
StringConstant *StringConstant::clone(const std::string &name) {
StringConstant *StringConstant::clone(const std::string& name) {
return new StringConstant(name, this);
}
std::string StringConstant::getString() const {
return Attributes::getString(itsAttr[0]);
}
void StringConstant::print(std::ostream &os) const {
void StringConstant::print(std::ostream& os) const {
os << "STRING " << getOpalName() << '=' << itsAttr[0] << ';';
os << std::endl;
}
void StringConstant::printValue(std::ostream &os) const {
void StringConstant::printValue(std::ostream& os) const {
os << itsAttr[0];
}
......@@ -2,7 +2,7 @@
// Class StringConstant
// The STRING CONSTANT definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// Copyright (c) 2000 - 2023, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
......@@ -24,7 +24,6 @@
class StringConstant: public ValueDefinition {
public:
/// Exemplar constructor.
StringConstant();
......@@ -32,29 +31,28 @@ public:
/// Test if object can be replaced.
// True, if [b]rhs[/b] is a string constant.
virtual bool canReplaceBy(Object *object);
virtual bool canReplaceBy(Object* object);
/// Make clone.
virtual StringConstant *clone(const std::string &name);
virtual StringConstant* clone(const std::string& name);
/// Print the constant.
virtual void print(std::ostream &) const;
virtual void print(std::ostream&) const;
/// Print its value
virtual void printValue(std::ostream &os) const;
virtual void printValue(std::ostream& os) const;
/// Return value.
virtual std::string getString() const;
private:
// Not implemented.
StringConstant(const StringConstant &);
void operator=(const StringConstant &);
StringConstant(const StringConstant&);
void operator=(const StringConstant&);
// Clone constructor.
StringConstant(const std::string &name, StringConstant *parent);
StringConstant(const std::string &name, StringConstant *parent, const std::string &value);
StringConstant(const std::string& name, StringConstant* parent);
StringConstant(const std::string& name, StringConstant* parent, const std::string& value);
};
#endif // OPAL_StringConstant_HH
\ No newline at end of file
#endif // OPAL_StringConstant_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment