8#include "MantidKernel/DllConfig.h"
39template <> MANTID_KERNEL_DLL std::string IPropertyManager::getValue<std::string>(
const std::string &
name)
const {
40 return getPropertyValue(
name);
43template <> MANTID_KERNEL_DLL Property *IPropertyManager::getValue<Property *>(
const std::string &
name)
const {
44 return getPointerToProperty(
name);
49IPropertyManager *IPropertyManager::setProperty<std::string>(
const std::string &
name,
const std::string &
value) {
58bool IPropertyManager::existsProperty(
const std::string &
name)
const {
59 auto const &props = this->getProperties();
60 return std::any_of(props.cbegin(), props.cend(), [&
name](
const auto prop) { return name == prop->name(); });
68void IPropertyManager::updatePropertyValues(
const IPropertyManager &other) {
69 auto props = this->getProperties();
70 for (
auto &prop : props) {
71 const std::string propName = (*prop).name();
72 if (
other.existsProperty(propName)) {
73 (*prop).setValueFromProperty(*
other.getPointerToProperty(propName));
83void IPropertyManager::setPropertySettings(
const std::string &
name, std::unique_ptr<IPropertySettings const> settings) {
84 Property *prop = getPointerToProperty(
name);
86 prop->setSettings(std::move(settings));
93bool IPropertyManager::isPropertyEnabled(
const std::string &
name)
const {
94 Property *prop = getPointerToProperty(
name);
96 return std::all_of(prop->getSettings().begin(), prop->getSettings().end(),
97 [
this](
auto const &ptr) { return ptr->isEnabled(this); });
107bool IPropertyManager::isPropertyVisible(
const std::string &
name)
const {
108 Property *prop = getPointerToProperty(
name);
110 return std::all_of(prop->getSettings().begin(), prop->getSettings().end(),
111 [
this](
auto const &ptr) { return ptr->isVisible(this); });
118std::vector<Property *> IPropertyManager::getPropertiesInGroup(
const std::string &
group)
const {
119 auto props = getProperties();
120 for (
auto prop = props.begin(); prop != props.end();) {
121 if ((**prop).getGroup() ==
group) {
124 prop = props.erase(prop);
132IPropertyManager::TypedValue::operator int16_t() {
return pm.getValue<int16_t>(prop); }
133IPropertyManager::TypedValue::operator uint16_t() {
return pm.getValue<uint16_t>(prop); }
134IPropertyManager::TypedValue::operator int32_t() {
return pm.getValue<int32_t>(prop); }
135IPropertyManager::TypedValue::operator uint32_t() {
return pm.getValue<uint32_t>(prop); }
136IPropertyManager::TypedValue::operator int64_t() {
return pm.getValue<int64_t>(prop); }
137IPropertyManager::TypedValue::operator uint64_t() {
return pm.getValue<uint64_t>(prop); }
138IPropertyManager::TypedValue::operator bool() {
return pm.getValue<
bool>(prop); }
139IPropertyManager::TypedValue::operator double() {
return pm.getValue<
double>(prop); }
140IPropertyManager::TypedValue::operator std::string() {
return pm.getPropertyValue(prop); }
141IPropertyManager::TypedValue::operator OptionalBool() {
return pm.getValue<OptionalBool>(prop); }
142IPropertyManager::TypedValue::operator Property *() {
return pm.getPointerToProperty(prop); }
151IPropertyManager::TypedValue::operator
unsigned long() {
return pm.getValue<
unsigned long>(prop); }
double value
The value of the point.
#define DEFINE_IPROPERTYMANAGER_GETVALUE(type)
A macro for defining getValue functions for new types.
Helper class which provides the Collimation Length for SANS instruments.