|
@@ -660,7 +660,7 @@ namespace impl {
|
|
|
*/
|
|
|
template <typename... ArgTypes>
|
|
|
class Zip : public DerivedValue<std::vector<std::tuple<ArgTypes...>>>,
|
|
|
- private _Zip<ArgTypes...>{
|
|
|
+ private _Zip<ArgTypes...>{
|
|
|
protected:
|
|
|
void update_value(){
|
|
|
this->value.clear();
|
|
@@ -688,26 +688,26 @@ template<typename> class Map; // undefined
|
|
|
* tuple should contain two floats. The Value object required by Map will
|
|
|
* typically be created as a Zip.
|
|
|
*/
|
|
|
-template <typename Ret, typename... ArgTypes>
|
|
|
-class Map<Ret(ArgTypes...)> : public DerivedValue<std::vector<Ret>>{
|
|
|
+template <typename Ret, typename ArgType>
|
|
|
+class Map<Ret(ArgType)> : public DerivedValue<std::vector<Ret>>{
|
|
|
private:
|
|
|
- typedef Value<std::vector<std::tuple<ArgTypes...>>> arg_type;
|
|
|
- Function<Ret(ArgTypes...)>& fn;
|
|
|
+ typedef Value<std::vector<ArgType>> arg_type;
|
|
|
+ Function<Ret(ArgType)>& fn;
|
|
|
arg_type* arg;
|
|
|
|
|
|
void update_value(){
|
|
|
this->value.clear();
|
|
|
- for(auto tup : arg->get_value()){
|
|
|
- this->value.push_back(call(fn,tup));
|
|
|
+ for(auto v : arg->get_value()){
|
|
|
+ this->value.push_back(fn(v));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public:
|
|
|
- static std::string fmt_name(Function<Ret(ArgTypes...)>& fn, arg_type* arg){
|
|
|
+ static std::string fmt_name(Function<Ret(ArgType)>& fn, arg_type* arg){
|
|
|
return "map("+fn.get_name()+":"+arg->get_name()+")";
|
|
|
}
|
|
|
|
|
|
- Map(Function<Ret(ArgTypes...)>& fn, arg_type* arg, const std::string& alias)
|
|
|
+ Map(Function<Ret(ArgType)>& fn, arg_type* arg, const std::string& alias)
|
|
|
:DerivedValue<std::vector<Ret>>(fmt_name(fn, arg), alias),
|
|
|
fn(fn), arg(arg){ }
|
|
|
|
|
@@ -1221,6 +1221,26 @@ class PointerValue : public DerivedValue<T*>{
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * Used for when the value is an object whose location in memory is changing,
|
|
|
+ * but one has a pointer to a pointer that points to the always updated
|
|
|
+ * location. (Mainly when reading objects such as stl containers from a root
|
|
|
+ * TTree)
|
|
|
+ */
|
|
|
+template <typename T>
|
|
|
+class ObjectValue : public DerivedValue<T>{
|
|
|
+ protected:
|
|
|
+ T** obj_pointer;
|
|
|
+ void update_value(){
|
|
|
+ this->value = **obj_pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ public:
|
|
|
+ ObjectValue(const std::string& name, T **ptr, const std::string alias="")
|
|
|
+ :DerivedValue<T>(name, alias),
|
|
|
+ obj_pointer(ptr){ }
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* A Value which always returns the same value, supplied in the constructor.
|
|
|
*/
|