Merge branch 'master' into feature/model-animation

* Resolve conflicts
This commit is contained in:
Malin Ejdbo
2021-03-17 13:19:04 +01:00
3 changed files with 20 additions and 5 deletions
+9 -1
View File
@@ -29,6 +29,7 @@
#include <ghoul/glm.h>
#include <functional>
#include <type_traits>
#include <variant>
namespace openspace::documentation {
@@ -1005,8 +1006,15 @@ struct OrVerifier : public Verifier {
* \param values The list of Verifiers that are to be tested
*
* \pre values must contain at least two values
*
* \todo: The use of the variant to use both raw pointers and shared pointers is
* definitely undesired. At the momement we are not handling the ownership of
* the verifiers very well and this must be cleaned up when doing a pass over
* the entire ownership model of the documentation/verifiers. For now it was
* necessary to make the codegen work in all cases without complications there
*/
OrVerifier(const std::vector<Verifier*> values);
OrVerifier(const std::vector<std::variant<Verifier*,
std::shared_ptr<Verifier>>> values);
/**
* Checks whether the \p dictionary contains the \p key and whether this key passes
+10 -3
View File
@@ -637,10 +637,17 @@ std::string AndVerifier::documentation() const {
return ghoul::join(documentations, ", ");
}
OrVerifier::OrVerifier(const std::vector<Verifier*> values_) {
OrVerifier::OrVerifier(
const std::vector<std::variant<Verifier*, std::shared_ptr<Verifier>>> values_)
{
ghoul_assert(!values_.empty(), "values must not be empty");
for (Verifier* v : values_) {
this->values.push_back(std::shared_ptr<Verifier>(v));
for (const std::variant<Verifier*, std::shared_ptr<Verifier>>& v : values_) {
if (std::holds_alternative<Verifier*>(v)) {
this->values.push_back(std::shared_ptr<Verifier>(std::get<Verifier*>(v)));
}
else {
this->values.push_back(std::get<std::shared_ptr<Verifier>>(v));
}
}
}