diff --git a/Application/src/commons/common/misc/metastring.h b/Application/src/commons/common/misc/metastring.h index 54de309985da90e372d812540bae1204498b6499..eb7db578b6fdcebad85f54018e41761062a331cb 100644 --- a/Application/src/commons/common/misc/metastring.h +++ b/Application/src/commons/common/misc/metastring.h @@ -242,6 +242,9 @@ namespace cmn { template <typename T> struct has_tostr_method; + template <typename T> + struct has_internal_tostr_method; + template <typename T> struct has_fromstr_method; } @@ -502,6 +505,16 @@ namespace cmn { std::string toStr(const typename std::enable_if< is_instantiation<std::shared_ptr, Q>::value && (Meta::has_tostr_method<typename Q::element_type>::value || std::is_convertible<typename Q::element_type, MetaObject>::value), Q >::type& obj) { return "ptr<"+Meta::name<typename Q::element_type>()+">" + (obj == nullptr ? "null" : Meta::toStr<typename Q::element_type>(*obj));//MetaType<typename std::remove_pointer<typename Q::element_type>::type>::toStr(*obj); } + + template<class Q> + std::string toStr(const typename std::enable_if< is_instantiation<std::shared_ptr, Q>::value && (Meta::has_internal_tostr_method<typename Q::element_type>::value), Q >::type& obj) { + return "ptr<"+Q::class_name()+">" + (obj == nullptr ? "null" : obj->toStr()); + } + + template<class Q> + std::string toStr(const typename std::enable_if< !is_instantiation<std::shared_ptr, Q>::value && (Meta::has_internal_tostr_method<Q>::value), Q >::type& obj) { + return "ptr<"+Q::class_name()+">" + obj.toStr(); + } template<class Q> std::string toStr(const typename std::enable_if< is_instantiation<std::shared_ptr, Q>::value && !Meta::has_tostr_method<typename Q::element_type>::value && !std::is_convertible<typename Q::element_type, MetaObject>::value, Q >::type& obj) { @@ -970,6 +983,21 @@ namespace cmn { static const bool value = std::is_same<std::true_type, decltype(test<T, dummy>(nullptr))>::value; }; + template <typename T> + struct has_internal_tostr_method + { + struct dummy { }; + + template <typename C, typename P> + static auto test(C * p) -> decltype(static_cast<void>(sizeof(decltype(p->toStr()))), std::true_type()); + + template <typename, typename> + static std::false_type test(...); + + typedef decltype(test<T, dummy>(nullptr)) type; + static const bool value = std::is_same<std::true_type, decltype(test<T, dummy>(nullptr))>::value; + }; + template <typename T> struct has_fromstr_method { diff --git a/Application/src/tracker/misc/default_config.cpp b/Application/src/tracker/misc/default_config.cpp index d8919f9d2da1baa28ece0a71d1b82daa5518977a..d7f70876328016fc1f8e5aeba5cbbc579298e8b5 100644 --- a/Application/src/tracker/misc/default_config.cpp +++ b/Application/src/tracker/misc/default_config.cpp @@ -385,7 +385,7 @@ file::Path conda_environment_path() { CONFIG("auto_number_individuals", false, "Program will automatically try to find the number of individuals (with sizes given in `blob_size_ranges`) and set `track_max_individuals` to that value."); CONFIG("track_speed_decay", float(0.7), "The amount the expected speed is reduced over time when an individual is lost. When individuals collide, depending on the expected behavior for the given species, one should choose different values for this variable. If the individuals usually stop when they collide, this should be set to a value > 0.8. If the individuals are expected to move over one another, the value should be set to a small value > 0."); - CONFIG("track_max_speed", float(50), "The maximum speed an individual can have (=> the maximum distance an individual can travel within one second) in cm/s. Uses `meta_real_width`."); + CONFIG("track_max_speed", float(10), "The maximum speed an individual can have (=> the maximum distance an individual can travel within one second) in cm/s. Uses `meta_real_width`."); CONFIG("posture_direction_smoothing", size_t(0), "Enables or disables smoothing of the posture orientation based on previous frames (not good for fast turns)."); CONFIG("speed_extrapolation", float(3), "Used for matching when estimating the next position of an individual. Smaller values are appropriate for lower frame rates. The higher this value is, the more previous frames will have significant weight in estimating the next position (with an exponential decay)."); CONFIG("track_intensity_range", Rangel(-1, -1), "When set to valid values, objects will be filtered to have an average pixel intensity within the given range.");