Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,21 +364,29 @@ class CSGObject | |
} | ||
} | ||
|
||
#define SGOBJECT_PUT_DECLARE(T) \ | ||
/** Setter for a class parameter, identified by a name. \ | ||
* Throws an exception if the class does not have such a parameter. \ | ||
* \ | ||
* @param name name of the parameter \ | ||
* @param value value of the parameter along with type information \ | ||
*/ \ | ||
void put(const std::string& name, T const& value) throw(ShogunException); | ||
|
||
SGOBJECT_PUT_DECLARE(int32_t) | ||
SGOBJECT_PUT_DECLARE(float32_t) | ||
SGOBJECT_PUT_DECLARE(float64_t) | ||
SGOBJECT_PUT_DECLARE(SGVector<int32_t>) | ||
SGOBJECT_PUT_DECLARE(SGVector<float64_t>) | ||
SGOBJECT_PUT_DECLARE(CSGObject*) | ||
#ifndef SWIG | ||
template <typename T, std::enable_if_t<std::is_convertible<T, CSGObject*>::value>* = nullptr> | ||
[[deprecated ("SGObject parameters should be registered as a base class.")]] | ||
void put(const std::string& name, const T value) | ||
{ | ||
CSGObject* v = value; | ||
Tag<CSGObject*> tag(name); | ||
put(tag, v); | ||
} | ||
#endif | ||
|
||
/** Setter for a class parameter, identified by a name. | ||
* Throws an exception if the class does not have such a parameter. | ||
* | ||
* @param name name of the parameter | ||
* @param value value of the parameter along with type information | ||
*/ | ||
template<typename T, typename U = typename std::enable_if_t<!std::is_convertible<T, CSGObject*>::value>> | ||
void put(const std::string& name, const T value) throw(ShogunException) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lisitsyn
Member
|
||
{ | ||
Tag<T> tag(name); | ||
put(tag, value); | ||
} | ||
|
||
/** Getter for a class parameter, identified by a Tag. | ||
* Throws an exception if the class does not have such a parameter. | ||
|
@lisitsyn so once we have owning policy shouldn't we actually starting implementing rvalue version of this as well, so that actually we dont do copies of elements but just move the whole thing into the
any
? and then just use any's move ctor?