Commit a05d0182 authored by Stephen's avatar Stephen
Browse files

Fix build warnings + remove redundant code

parent 0f11d4a8
......@@ -98,7 +98,7 @@ public:
/// Returns the name of parameter i
std::string parameterName(size_t i) const override;
/// Returns the name of attribute i
std::string attributeName(size_t i) const;
std::string attributeName(size_t i) const override;
/// Returns the description of parameter i
std::string parameterDescription(size_t i) const override;
/// Checks if a parameter has been set explicitly
......@@ -220,7 +220,7 @@ protected:
/// Declare a single attribute
void declareAttribute(const std::string &name,
const API::IFunction::Attribute &defaultValue) override;
const API::IFunction::Attribute &defaultValue);
/// Writes itself into a string
std::string writeToString(
const std::string &parentLocalAttributesStr = "") const override;
......
......@@ -587,8 +587,8 @@ protected:
virtual void declareParameters() {}
/// Declare a single attribute
virtual void declareAttribute(const std::string &name,
const API::IFunction::Attribute &defaultValue);
void declareAttribute(const std::string &name,
const API::IFunction::Attribute &defaultValue);
/// Store an attribute's value
void storeAttributeValue(const std::string &name,
const API::IFunction::Attribute &value);
......
......@@ -270,7 +270,7 @@ bool CompositeFunction::hasAttribute(const std::string &name) const {
}
auto [attributeName, index] = parseName(name);
return m_functions[index]->hasAttribute(attributeName);
} catch (...) {
} catch (std::invalid_argument &) {
return false;
}
}
......
......@@ -222,8 +222,7 @@ size_t FunctionGenerator::nAttributes() const {
/// Returns a list of attribute names
std::vector<std::string> FunctionGenerator::getAttributeNames() const {
checkTargetFunction();
std::vector<std::string> attNames = IFunction::getAttributeNames();
return attNames;
return IFunction::getAttributeNames();
}
/// Return a value of attribute attName
......
......@@ -49,7 +49,7 @@ public:
/// Check if attribute attName exists
bool hasAttribute(const std::string &attName) const override;
// return attribute name from ith attribute
std::string attributeName(size_t index) const;
std::string attributeName(size_t index) const override;
private:
/// Function that does the actual job
......
......@@ -402,7 +402,7 @@ void CrystalFieldFunction::buildAttributeNames() const {
return;
}
auto numAttributes = IFunction::nAttributes();
for (int i = 0; i < numAttributes; ++i) {
for (size_t i = 0; i < numAttributes; ++i) {
m_attributeNames.emplace_back(IFunction::attributeName(i));
}
auto controlAttributeNames = m_control.getAttributeNames();
......
......@@ -241,7 +241,6 @@ void TabulatedFunction::setAttribute(const std::string &attName,
/// Returns the number of attributes associated with the function
size_t TabulatedFunction::nAttributes() const {
// additional X and Y attributes
return IFunction::nAttributes();
}
......
......@@ -111,7 +111,6 @@ public:
TabulatedFunction fun;
fun.setAttributeValue("FileName", m_nexusFileName);
fun.setAttributeValue("WorkspaceIndex", 10);
std::cout << "fun" << fun.asString() << std::endl;
TS_ASSERT_EQUALS(fun.getParameter("Scaling"), 1.0);
TS_ASSERT_EQUALS(fun.getAttribute("FileName").asUnquotedString(),
m_nexusFileName);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment