Revert to using ghoul::any due to lack of support on macOS

This commit is contained in:
Alexander Bock
2017-07-17 13:46:35 -04:00
parent 096e751de2
commit 90e0364c5a
8 changed files with 26 additions and 26 deletions

View File

@@ -327,7 +327,7 @@ bool NumericalProperty<T>::setStringValue(std::string value) {
value, success
);
if (success)
TemplateProperty<T>::set(std::any(std::move(thisValue)));
TemplateProperty<T>::set(ghoul::any(std::move(thisValue)));
return success;
}

View File

@@ -114,11 +114,11 @@ public:
/**
* This method returns the encapsulated value of the Property to the caller. The type
* that is returned is determined by the type function and is up to the developer of
* the derived class. The default implementation returns an empty std::any object.
* \return The value that is encapsulated by this Property, or an empty std::any
* the derived class. The default implementation returns an empty ghoul::any object.
* \return The value that is encapsulated by this Property, or an empty ghoul::any
* object if the method was not overritten.
*/
virtual std::any get() const;
virtual ghoul::any get() const;
/**
* Sets the value encapsulated by this Property to the <code>value</code> passed to
@@ -128,7 +128,7 @@ public:
* implementation of this method ignores the input.
* \param value The new value that should be stored in this Property
*/
virtual void set(std::any value);
virtual void set(ghoul::any value);
/**
* This method returns the type that is requested by this Property for the set method.

View File

@@ -84,21 +84,21 @@ public:
virtual std::string className() const override;
/**
* Returns the stored value packed into a std::any object.
* \return The stored value packed into a std::any object
* Returns the stored value packed into a ghoul::any object.
* \return The stored value packed into a ghoul::any object
*/
virtual std::any get() const override;
virtual ghoul::any get() const override;
/**
* Sets the value from the provided std::any object. If the types between
* Sets the value from the provided ghoul::any object. If the types between
* <code>T</code> and <code>value</code> disagree, an error is logged and the stored
* value remains unchanged.
*/
virtual void set(std::any value) override;
virtual void set(ghoul::any value) override;
/**
* Returns the <code>std::type_info</code> describing the template parameter
* <code>T</code>. It can be used to test against a std::any value before trying to
* <code>T</code>. It can be used to test against a ghoul::any value before trying to
* assign it.
* \return The type info object describing the template parameter <code>T</code>
*/

View File

@@ -213,14 +213,14 @@ std::ostream& operator<<(std::ostream& os, const TemplateProperty<T>& obj) {
}
template <typename T>
std::any TemplateProperty<T>::get() const {
return std::any(_value);
ghoul::any TemplateProperty<T>::get() const {
return ghoul::any(_value);
}
template <typename T>
void TemplateProperty<T>::set(std::any value) {
void TemplateProperty<T>::set(ghoul::any value) {
try {
T v = std::any_cast<T>(std::move(value));
T v = ghoul::any_cast<T>(std::move(value));
if (v != _value) {
_value = std::move(v);
notifyListener();
@@ -254,7 +254,7 @@ bool TemplateProperty<T>::setLuaValue(lua_State* state) {
success
);
if (success) {
set(std::any(thisValue));
set(ghoul::any(thisValue));
}
return success;
}
@@ -281,7 +281,7 @@ bool TemplateProperty<T>::setStringValue(std::string value) {
success
);
if (success) {
set(std::any(thisValue));
set(ghoul::any(thisValue));
}
return success;
}

View File

@@ -63,7 +63,7 @@ public:
* listeners regardless of the value
* \param value The ignored value
*/
void set(std::any value);
void set(ghoul::any value);
};
} // namespace openspace::properties

View File

@@ -279,16 +279,16 @@ void RenderablePlanetProjection::imageProjectGPU(
_fboProgramObject->setUniform("boresight" , _boresight);
if (_geometry->hasProperty("radius")){
std::any r = _geometry->property("radius")->get();
if (glm::vec3* radius = std::any_cast<glm::vec3>(&r)){
ghoul::any r = _geometry->property("radius")->get();
if (glm::vec3* radius = ghoul::any_cast<glm::vec3>(&r)){
_fboProgramObject->setUniform("_radius", radius);
}
}else{
LERROR("Geometry object needs to provide radius");
}
if (_geometry->hasProperty("segments")){
std::any s = _geometry->property("segments")->get();
if (int* segments = std::any_cast<int>(&s)){
ghoul::any s = _geometry->property("segments")->get();
if (int* segments = ghoul::any_cast<int>(&s)){
_fboProgramObject->setUniform("_segments", segments[0]);
}
}else{

View File

@@ -81,15 +81,15 @@ std::string Property::fullyQualifiedIdentifier() const {
return identifier;
}
std::any Property::get() const {
return std::any();
ghoul::any Property::get() const {
return ghoul::any();
}
bool Property::getLuaValue(lua_State*) const {
return false;
}
void Property::set(std::any) {}
void Property::set(ghoul::any) {}
bool Property::setLuaValue(lua_State*) {
return false;

View File

@@ -40,7 +40,7 @@ bool TriggerProperty::setLuaValue(lua_State*) {
return true;
}
void TriggerProperty::set(std::any) {
void TriggerProperty::set(ghoul::any) {
notifyListener();
}