#include <algorithm>
#include <vector>
-namespace caspar { namespace core {
+namespace caspar {
typedef std::function<double(double, double, double, double)> tweener_t;
params.push_back(boost::lexical_cast<double>(what["V1"].str()));
}
- auto tweens = get_tweens();
-
- auto it = tweens.find(name);
- if(it == tweens.end())
- CASPAR_THROW_EXCEPTION(invalid_argument() << msg_info("Could not find tween.") << arg_value_info(name));
+ auto it = get_tweens().find(name);
+ if(it == get_tweens().end())
+ CASPAR_THROW_EXCEPTION(user_error() << msg_info(L"Could not find tween " + name));
auto tween = it->second;
return [=](double t, double b, double c, double d)
tweener::tweener(const std::wstring& name)
: func_(get_tweener(name))
+ , name_(name)
{
}
-tweener::tweener(const wchar_t* name)
- : func_(get_tweener(name))
+double tweener::operator()(double t, double b , double c, double d) const
{
+ return func_(t, b, c, d);
}
-double tweener::operator()(double t, double b , double c, double d) const
+bool tweener::operator==(const tweener& other) const
{
- return func_(t, b, c, d);
+ return name_ == other.name_;
+}
+
+bool tweener::operator!=(const tweener& other) const
+{
+ return !(*this == other);
}
-const std::vector<const std::wstring>& tweener::names()
+const std::vector<std::wstring>& tweener::names()
{
- static const auto names = cpplinq::from(get_tweens())
+ /*static const auto names = cpplinq::from(get_tweens())
.select(keys())
- .to_vector();
+ .to_vector();*/
+
+ static const auto result = []
+ {
+ std::vector<std::wstring> tweens;
- return names;
+ for (auto& tween : get_tweens())
+ tweens.push_back(tween.first);
+
+ return tweens;
+ }();
+ //static const std::vector<std::wstring> result;
+
+ return result;
}
-}}
+}