text:
#include "Package.hpp"
#include "Logger.hpp"
#include "Validation.hpp"

#include <boost/foreach.hpp>
#include <boost/regex.hpp>

//
// Constructors & Destructors
//

BoxCar::Packaging::Package::Package(std::string name) {
    this->name = name;
}

BoxCar::Packaging::Package::Package() {
    Package("");
}

//
// Getters & Setters
//

void BoxCar::Packaging::Package::setName(std::string newName) {
    this->name = newName;
}

void BoxCar::Packaging::Package::setVersion(std::string newVersion) {
    this->version = newVersion;
}

std::string BoxCar::Packaging::Package::getName() {
    return this->name;
}

std::string BoxCar::Packaging::Package::getVersion() {
    return this->version;
}

std::vector<BoxCar::Packaging::Dependency> BoxCar::Packaging::Package::getDependencies() {
    return this->dependencies;
}

//
// Data Methods
//

void BoxCar::Packaging::Package::readFromPropertyTree(const boost::property_tree::ptree& pt) {
    this->name = pt.get<std::string>("name");
    this->version = pt.get<std::string>("version");

    BOOST_FOREACH(const boost::property_tree::ptree::value_type &v, pt.get_child("dependencies")) {
        Dependency dependency;
        dependency.readFromPropertyTree(v.second);

        this->dependencies.push_back(dependency);
    }
}

void BoxCar::Packaging::Package::readFromJsonString(const std::string &json) {
    std::stringstream stream;
    stream << json;

    boost::property_tree::ptree pt;
    boost::property_tree::read_json(stream, pt);

    this->readFromPropertyTree(pt);
}

void BoxCar::Packaging::Package::readFromJsonFile(const std::string& filePath) {
    boost::property_tree::ptree pt;
    boost::property_tree::read_json(filePath, pt);

    this->readFromPropertyTree(pt);
}

void BoxCar::Packaging::Package::installAllDependencies() {
    std::stringstream installingAllStream;
    installingAllStream << "Installing all dependencies of package " << this->name << "@" << this->version << "...";

    BoxCar::Logging::Logger::inf(installingAllStream.str());

    BOOST_FOREACH(Dependency& dependency, this->dependencies) {
        std::stringstream installMessageStream;
        installMessageStream << "Installing " << dependency.getName() << "@" << dependency.getVersion() << "...";

        BoxCar::Logging::Logger::inf(installMessageStream.str());
    }
}

BoxCar::Packaging::PackageValidity BoxCar::Packaging::Package::validate() {
    if (!BoxCar::Validation::validateName(this->name)) return PackageValidity {
        false,
        "'name' field must only contain alphanumeric characters, underscores, hyphens, and periods."
    };

    if (!BoxCar::Validation::validateVersion(this->version)) return PackageValidity {
        false,
        "'version' field must be a valid version (x.x.x)."
    };

    BOOST_FOREACH(Dependency& dependency, this->dependencies) {
        if (!BoxCar::Validation::validateName(dependency.getName())) return PackageValidity {
            false,
            "'name' field of dependency must only contain alphanumeric characters, underscores, hyphens, and periods."
        };

        if (!BoxCar::Validation::validateVersion(dependency.getVersion())) return PackageValidity {
            false,
            "'version' field of dependency must be a valid version (x.x.x)."
        };
    }

    return PackageValidity {
        true,
        ""
    };
}

max_stars_repo_name: CabooseLang/BoxCar

max_issues_repo_name: CabooseLang/BoxCar

max_forks_repo_name: CabooseLang/BoxCar


text:
//
// experimental/promise.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2021-2022 Klemens D. Morgenstern
//                         (klemens dot morgenstern at gmx dot net)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_ASIO_EXPERIMENTAL_PROMISE_HPP
#define BOOST_ASIO_EXPERIMENTAL_PROMISE_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/experimental/detail/completion_handler_erasure.hpp>
#include <boost/asio/experimental/impl/promise.hpp>
#include <boost/asio/post.hpp>

#include <algorithm>
#include <variant>

#include <boost/asio/detail/push_options.hpp>

namespace boost {
namespace asio {
namespace experimental {

template <typename Executor = any_io_executor>
struct use_promise_t {};

constexpr use_promise_t<> use_promise;

template <typename T>
struct is_promise : std::false_type {};

template <typename ... Ts>
struct is_promise<promise<Ts...>> : std::true_type {};

template <typename T>
constexpr bool is_promise_v = is_promise<T>::value;

template <typename T>
concept is_promise_c = is_promise_v<std::remove_reference_t<T>>;

template <typename ... Ts>
struct promise_value_type
{
  using type = std::tuple<Ts...>;
};

template <typename T>
struct promise_value_type<T>
{
  using type = T;
};

template <>
struct promise_value_type<>
{
  using type = std::monostate;
};

#if defined(GENERATING_DOCUMENTATION)
/// The primary template is not defined.
template<typename Signature = void(), typename Executor = any_io_executor>
struct promise
{
};
#endif // defined(GENERATING_DOCUMENTATION)

template <typename ... Ts, typename Executor>
struct promise<void(Ts...), Executor>
{
  using value_type = typename promise_value_type<Ts...>::type;
  using tuple_type = std::tuple<Ts...>;
  using executor_type = Executor;

  executor_type get_executor() const
  {
    if (impl_)
      return impl_->executor;
    else
      return {};
  }

  void cancel(cancellation_type level = cancellation_type::all)
  {
    if (impl_ && !impl_->done)
    {
      boost::asio::dispatch(impl_->executor,
          [level, impl = impl_]{impl->cancel.emit(level);});
    }
  }

  bool complete() const noexcept
  {
    return impl_ && impl_->done;
  }

  template <typename CompletionToken>
  auto async_wait(CompletionToken&& token)
  {
    assert(impl_);

    return async_initiate<CompletionToken, void(Ts...)>(
        initiate_async_wait{impl_}, token);
  }

  promise() = delete;
  promise(const promise& ) = delete;
  promise(promise&& ) noexcept = default;

  ~promise() { cancel(); }

  template <execution::executor Executor1, is_promise_c ... Ps>
  static auto race(Executor1 exec, Ps ... ps)
    -> promise<void(std::variant<typename Ps::value_type...>), Executor1>
  {
    using var_t = std::variant<typename Ps::value_type...>;
    using pi = detail::promise_impl<void(var_t), Executor1>;

    struct impl_t : pi
    {
      impl_t(Executor1 exec, Ps&& ... ps)
        : pi(std::move(exec)),
          tup(std::move(ps)...)
      {
        this->slot.template emplace<cancel_handler>(this);
      }

      struct cancel_handler
      {
        impl_t* self;

        cancel_handler(impl_t* self)
          : self(self)
        {
        }

        void operator()(cancellation_type ct)
        {
          [ct, s=self]<std::size_t... Idx>(std::index_sequence<Idx...>)
          {
            (std::get<Idx>(s->tup).cancel(ct), ... );
          }(std::make_index_sequence<sizeof...(Ps)>{});
        }
      };

      std::tuple<std::remove_reference_t<Ps>...> tup;
      cancellation_slot slot{this->cancel.slot()};
    };

    auto impl = std::allocate_shared<impl_t>(
        get_associated_allocator(exec), exec, std::move(ps)...);

    impl->executor = exec;

    [impl, exec]<std::size_t... Idx>(std::index_sequence<Idx...>)
    {
      auto step =
        [&]<std::size_t I>(std::integral_constant<std::size_t, I>)
        {
          return [impl]<typename... Args > (Args&& ... args)
          {
            if (impl->done)
              return;
            impl->result = var_t(std::in_place_index<I>,
                std::forward<Args>(args)...);
            impl->done = true;
            if (auto f = std::exchange(impl->completion, nullptr); !!f)
              std::apply(std::move(f), std::move(*impl->result));

            auto cancel =
              [&]<std::size_t Id>(std::integral_constant<std::size_t, Id>)
              {
                if constexpr (I != Id)
                  get<I>(impl->tup).cancel();
              };

            (cancel(std::integral_constant<std::size_t, Idx>{}), ...);
          };
        };

      (
        std::get<Idx>(impl->tup).async_wait(
          bind_executor(exec,
            step(std::integral_constant<std::size_t, Idx>{}))),
        ...
      );
    }(std::make_index_sequence<sizeof...(Ps)>{});

    return {impl};
  }

  template <execution::executor Executor1, is_promise_c ... Ps>
  static auto all(Executor1 exec, Ps ... ps)
    -> promise<void(typename Ps::value_type...), Executor1>
  {
    using pi = detail::promise_impl<
        void(typename Ps::value_type...), Executor1>;

    struct impl_t : pi
    {
      impl_t(Executor1 exec, Ps&& ... ps)
        : pi(std::move(exec)),
          tup(std::move(ps)...)
      {
        this->slot.template emplace<cancel_handler>(this);
      }

      struct cancel_handler
      {
        impl_t* self;

        cancel_handler(impl_t* self)
          : self(self)
        {
        }

        void operator()(cancellation_type level)
        {
          [level, s=self]<std::size_t... Idx>(std::index_sequence<Idx...>)
          {
            (std::get<Idx>(s->tup).cancel(level), ... );
          }(std::make_index_sequence<sizeof...(Ps)>{});
        }
      };

      std::tuple<std::remove_reference_t<Ps>...> tup;
      std::tuple<std::optional<typename Ps::value_type>...> partial_result;
      cancellation_slot slot{this->cancel.slot()};
    };

    auto impl = std::allocate_shared<impl_t>(
        get_associated_allocator(exec), exec, std::move(ps)...);
    impl->executor = exec;

    [impl, exec]<std::size_t... Idx>(std::index_sequence<Idx...>)
    {
      auto step =
        [&]<std::size_t I>(std::integral_constant<std::size_t, I>)
        {
          return [impl]<typename... Args>(Args&& ... args)
          {
            std::get<I>(impl->partial_result).emplace(
                std::forward<Args>(args)...);
            if ((std::get<Idx>(impl->partial_result) && ...)) // we're done.
            {
              impl->result = {*std::get<Idx>(impl->partial_result)...};

              impl->done = true;
              if (auto f = std::exchange(impl->completion, nullptr); !!f)
                std::apply(std::move(f), std::move(*impl->result));
            }
          };
        };

      (
        std::get<Idx>(impl->tup).async_wait(
          bind_executor(exec,
            step(std::integral_constant<std::size_t, Idx>{}))),
        ...
      );
    }(std::make_index_sequence<sizeof...(Ps)>{});

    return {impl};
  }

  template <is_promise_c ... Ps>
  static auto race(Ps  ... ps)
  {
    auto exec = get<0>(std::tie(ps...)).get_executor();
    return race(std::move(exec), std::move(ps)...);
  }

  template <is_promise_c ... Ps>
  static auto all(Ps ... ps)
  {
    auto exec = get<0>(std::tie(ps...)).get_executor();
    return all(std::move(exec), std::move(ps)...);
  }

  template <execution::executor Executor1, typename Range>
#if !defined(GENERATING_DOCUMENTATION)
    requires requires (Range r)
    {
      {*std::begin(r)} -> is_promise_c;
      {*std::  end(r)} -> is_promise_c;
    }
#endif // !defined(GENERATING_DOCUMENTATION)
  static auto race(Executor1 exec, Range range)
  {
    using var_t = typename std::decay_t<
        decltype(*std::begin(range))>::value_type;
    using signature_type = std::conditional_t<
        std::is_same_v<var_t, std::monostate>,
        void(std::size_t),
        void(std::size_t, var_t)>;
    using pi = detail::promise_impl<signature_type, Executor1>;
    using promise_t = promise<signature_type, Executor1>;

    struct impl_t : pi
    {
      impl_t(Executor1 exec, Range&& range)
        : pi(std::move(exec)),
          range(std::move(range))
      {
        this->slot.template emplace<cancel_handler>(this);
      }

      struct cancel_handler
      {
        impl_t* self;

        cancel_handler(impl_t* self)
          : self(self)
        {
        }

        void operator()(boost::asio::cancellation_type ct)
        {
          for (auto& r : self->range)
            r.cancel(ct);
        }
      };

      Range range;
      cancellation_slot slot{this->cancel.slot()};
    };

    const auto size = std::distance(std::begin(range), std::end(range));
    auto impl =  std::allocate_shared<impl_t>(
        get_associated_allocator(exec), exec, std::move(range));
    impl->executor = exec;

    if (size == 0u)
    {
      if constexpr (std::is_same_v<var_t, std::monostate>)
        impl->result = {-1};
      else
        impl->result = {-1, var_t{}};

      impl->done = true;
      if (auto f = std::exchange(impl->completion, nullptr); !!f)
      {
        boost::asio::post(exec,
            [impl, f = std::move(f)]() mutable
            {
              std::apply(std::move(f), std::move(*impl->result));
            });
      }
      return promise_t{impl};
    }
    auto idx = 0u;
    for (auto& val : impl->range)
    {
      val.async_wait(
          bind_executor(exec,
            [idx, impl]<typename... Args>(Args&&... args)
            {
              if (impl->done)
                return;
              if constexpr (std::is_same_v<var_t, std::monostate>)
                impl->result = idx;
              else
                impl->result = std::make_tuple(idx,
                    var_t(std::forward<Args>(args)...));
              impl->done = true;
              if (auto f = std::exchange(impl->completion, nullptr); !!f)
                std::apply(std::move(f), std::move(*impl->result));

              auto jdx = 0u;

              for (auto &tc : impl->range)
                if (jdx++ != idx)
                  tc.cancel();
            }));
      idx++;
    }
    return promise_t{impl};
  }

  template <execution::executor Executor1, typename Range>
#if !defined(GENERATING_DOCUMENTATION)
    requires requires (Range r)
    {
      {*std::begin(r)} -> is_promise_c;
      {*std::  end(r)} -> is_promise_c;
    }
#endif // !defined(GENERATING_DOCUMENTATION)
  static auto all(Executor1 exec, Range  range)
    -> promise<
        void(
          std::vector<
            typename std::decay_t<
              decltype(*std::begin(range))
            >::value_type
          >
        ), Executor1>
  {
    using var_t = typename std::decay_t<
      decltype(*std::begin(range))>::value_type;
    using pi = detail::promise_impl<void(std::vector<var_t>), Executor1>;

    struct impl_t : pi
    {
      impl_t(Executor1 exec, Range&& range)
        : pi(std::move(exec)),
          range(std::move(range))
      {
        this->slot.template emplace<cancel_handler>(this);
      }

      struct cancel_handler
      {
        impl_t* self;

        cancel_handler(impl_t* self)
          : self(self)
        {
        }

        void operator()(cancellation_type ct)
        {
          for (auto& r : self->range)
            r.cancel(ct);
        }
      };

      Range range;
      std::vector<std::optional<var_t>> partial_result;
      cancellation_slot slot{this->cancel.slot()};
    };

    const auto size = std::distance(std::begin(range), std::end(range));
    auto impl =  std::allocate_shared<impl_t>(
        get_associated_allocator(exec), exec, std::move(range));
    impl->executor = exec;
    impl->partial_result.resize(size);

    if (size == 0u)
    {
      impl->result.emplace();
      impl->done = true;
      if (auto f = std::exchange(impl->completion, nullptr); !!f)
        boost::asio::post(exec, [impl, f = std::move(f)]() mutable
            {
              std::apply(std::move(f), std::move(*impl->result));
            });
      return {impl};
    }
    auto idx = 0u;
    for (auto& val : impl->range) {
      val.async_wait(bind_executor(
          exec,
          [idx, impl]<typename... Args>(Args&&... args) {

            impl->partial_result[idx].emplace(std::forward<Args>(args)...);
            if (std::all_of(impl->partial_result.begin(),
                  impl->partial_result.end(),
                  [](auto &opt) {return opt.has_value();}))
            {
              impl->result.emplace();
              get<0>(*impl->result).reserve(impl->partial_result.size());
              for (auto& p : impl->partial_result)
                get<0>(*impl->result).push_back(std::move(*p));

              impl->done = true;
              if (auto f = std::exchange(impl->completion, nullptr); !!f)
                std::apply(std::move(f), std::move(*impl->result));
            }

          }));
      idx++;
    }
    return {impl};
  }

  template <typename Range>
#if !defined(GENERATING_DOCUMENTATION)
    requires requires (Range r)
    {
      {*std::begin(r)} -> is_promise_c;
      {*std::  end(r)} -> is_promise_c;
    }
#endif // !defined(GENERATING_DOCUMENTATION)
  static auto race(Range range)
  {
    if (std::begin(range) == std::end(range))
      throw std::logic_error(
          "Can't use race on an empty range with deduced executor");
    else
    {
      auto ex = std::begin(range)->get_executor();
      return race(ex, std::move(range));
    }
  }

  template <typename Range>
#if !defined(GENERATING_DOCUMENTATION)
    requires requires (Range&& r)
    {
      {*std::begin(r)} -> is_promise_c;
      {*std::  end(r)} -> is_promise_c;
    }
#endif // !defined(GENERATING_DOCUMENTATION)
  static auto all(Range range)
  {
    if (std::begin(range) == std::end(range))
      throw std::logic_error(
          "Can't use all on an empty range with deduced executor");
    else
    {
      auto ex = std::begin(range)->get_executor();
      return all(ex, std::move(range));
    }
  }

private:
#if !defined(GENERATING_DOCUMENTATION)
  template <typename, typename> friend struct promise;
  friend struct detail::promise_handler<void(Ts...)>;
#endif // !defined(GENERATING_DOCUMENTATION)

  std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> impl_;
  promise(std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> impl)
    : impl_(impl)
  {
  }

  struct initiate_async_wait
  {
    std::shared_ptr<detail::promise_impl<void(Ts...), Executor>> self_;

    template <typename WaitHandler>
    void operator()(WaitHandler&& handler) const
    {
      const auto exec = get_associated_executor(handler, self_->executor);
      auto cancel = get_associated_cancellation_slot(handler);
      if (self_->done)
      {
        boost::asio::post(exec,
            [self = self_, h = std::forward<WaitHandler>(handler)]() mutable
            {
              std::apply(std::forward<WaitHandler>(h),
                  std::move(*self->result));
            });
      }
      else
      {
        if (cancel.is_connected())
        {
          struct cancel_handler
          {
            std::weak_ptr<detail::promise_impl<void(Ts...), Executor>> self;

            cancel_handler(
                std::weak_ptr<detail::promise_impl<void(Ts...), Executor>> self)
              : self(std::move(self))
            {
            }

            void operator()(cancellation_type level) const
            {
              if (auto p = self.lock(); p != nullptr)
                p->cancel.emit(level);

            }
          };

          cancel.template emplace<cancel_handler>(self_);
        }

        self_->completion = {exec, std::forward<WaitHandler>(handler)};
      }
    }
  };
};

} // namespace experimental

#if !defined(GENERATING_DOCUMENTATION)

template <typename Executor, typename R, typename... Args>
struct async_result<experimental::use_promise_t<Executor>, R(Args...)>
{
  using handler_type = experimental::detail::promise_handler<
    void(typename decay<Args>::type...), Executor>;

  template <typename Initiation, typename... InitArgs>
  static auto initiate(Initiation initiation,
      experimental::use_promise_t<Executor>, InitArgs... args)
    -> typename handler_type::promise_type
  {
    handler_type ht{get_associated_executor(initiation)};
    std::move(initiation)(ht, std::move(args)...);
    return ht.make_promise();
  }
};

#endif // !defined(GENERATING_DOCUMENTATION)

} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#endif // BOOST_ASIO_EXPERIMENTAL_PROMISE_HPP

ext: hpp


text: #include <boost/mpl/aux_/preprocessed/gcc/unpack_args.hpp>

max_stars_repo_name: miathedev/BoostForArduino

max_issues_repo_name: miathedev/BoostForArduino

max_forks_repo_name: miathedev/BoostForArduino


text:
#include "Internationalizator.h"

#ifdef _WIN32
#pragma warning(disable:4503)
#pragma warning(push)
#pragma warning(disable:4996 4251 4275 4800)
#endif
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/lock_guard.hpp>
#ifdef _WIN32
#pragma warning(pop)
#endif

using namespace std;
using boost::recursive_mutex;
using boost::lock_guard;

namespace charliesoft
{
  recursive_mutex _internationalizatorMutex;
  Internationalizator *Internationalizator::ptr = NULL;

  boost::format my_format(const std::string & f_string) {
    using namespace boost::io;
    boost::format fmter(f_string);
    fmter.exceptions(no_error_bits);//no exceptions wanted!
    return fmter;
  }

  Internationalizator::Internationalizator()
  {
    initTranslations();
  }

  Internationalizator* Internationalizator::getInstance()
  {
    lock_guard<recursive_mutex> guard(_internationalizatorMutex);
    if (ptr == NULL)
      ptr = new Internationalizator();
    return ptr;
  };

  void Internationalizator::releaseInstance()
  {
    lock_guard<recursive_mutex> guard(_internationalizatorMutex);
    if (ptr != NULL)
      delete ptr;
    ptr = NULL;
  };

  void Internationalizator::setLang(std::string resourceFile)
  {
    ///\todo
  };

  std::string Internationalizator::getTranslation(std::string key){
    if (translations.find(key) != translations.end())
      return translations[key];
    else
      return key;
  };

  std::string _STR(std::string key)
  {
    return Internationalizator::getInstance()->getTranslation(key).c_str();
  };

  QString _QT(std::string key)
  {
    QString output = Internationalizator::getInstance()->getTranslation(key).c_str();
    return output;
  };

  void Internationalizator::initTranslations()
  {
    translations["TRUE"] = "True";
    translations["FALSE"] = "False";
    translations["ALL_TYPES"] = "All types";

    translations["BUTTON_OK"] = "OK";
    translations["BUTTON_CANCEL"] = "Cancel";
    translations["BUTTON_DELETE"] = "Delete";
    translations["BUTTON_BROWSE"] = "Browse...";
    translations["BUTTON_UPDATE"] = "Update";
    translations["BUTTON_COLOR"] = "Color editor";
    translations["BUTTON_MATRIX"] = "Matrix editor";
    translations["BUTTON_ADD_INPUT"] = "Add input...";
    translations["BUTTON_ADD_OUTPUT"] = "Add output...";
    translations["BUTTON_SWITCH_SYNC"] = "Change block rendering type
(currently synchrone)";
    translations["BUTTON_SWITCH_ASYNC"] = "Change block rendering type
(currently asyncrone)";
    translations["BUTTON_SWITCH_ONESHOT"] = "Change block rendering type
(currently one shot)";

    translations["TYPE_DATAS_BOOL"] = "Boolean";
    translations["TYPE_DATAS_INT"] = "Int";
    translations["TYPE_DATAS_FLOAT"] = "Float";
    translations["TYPE_DATAS_COLOR"] = "Color";
    translations["TYPE_DATAS_MATRIX"] = "Matrix";
    translations["TYPE_DATAS_STRING"] = "String";
    translations["TYPE_DATAS_FILE"] = "FilePath";
    translations["TYPE_DATAS_LISTBOX"] = "ListBox";
    translations["TYPE_DATAS_ERROR"] = "typeError";

    translations["CONDITION_EDITOR"] = "Condition editor...";
    translations["CONDITION_EDITOR_HELP"] = "You can define here which conditions are needed for block rendering!";
    translations["CONDITION_BLOCK_ERROR_INPUT"] = "Condition can't be input of block...";
    translations["CONDITION_BLOCK_LEFT"] = "left";
    translations["CONDITION_BLOCK_HELP"] = "link to the output's block
whose value will be used in condition";
    translations["CONDITION_BLOCK_RIGHT"] = "right";
    translations["CONDITION_CARDINAL"] = "#rendering";
    translations["CONDITION_IS_EMPTY"] = "is empty";

    translations["NOT_INITIALIZED"] = "Not initialized...";
    translations["PROCESSING_TIME"] = "Mean processing time: ";

    translations["BLOCK_OUTPUT"] = "output";
    translations["BLOCK_INPUT"] = "input";
    translations["BLOCK_TITLE_INPUT"] = "Input";
    translations["BLOCK_TITLE_IMG_PROCESS"] = "2D processing";
    translations["BLOCK_TITLE_SIGNAL"] = "Video processing";
    translations["BLOCK_TITLE_MATH"] = "Math op.";
    translations["BLOCK_TITLE_OUTPUT"] = "Output";
    translations["BLOCK_TITLE_INFOS"] = "Infos";
    translations["BLOCK_INFOS"] =
      "
Statistics
"
      "

Mean processing time:	%1$s ms
"
      "
Max processing time:	%2$s ms
"
      "
Min processing time:	%3$s ms
"
      "
Nb rendering:	%4$s

"
      "
Errors
"
      "
%5$s
";

    translations["ERROR_GENERIC"] = "Error undefined!";
    translations["ERROR_GENERIC_TITLE"] = "Error!";
    translations["ERROR_CONFIRM_SET_VALUE"] = "Wrong input, are you sure you want to set this value?";
    translations["ERROR_TYPE"] = "The type of \"%1$s.%2$s\" (%3$s) doesn't correspond to \"%4$s.%5$s\" (%6$s)";
    translations["ERROR_LINK_WRONG_INPUT_OUTPUT"] = "You can't link %1$s to %2$s : same type (%3$s)!";
    translations["ERROR_LINK_SAME_BLOCK"] = "You can't link the same block!";
    translations["ERROR_PARAM_EXCLUSIF"] = "Params \"%1$s\" and \"%2$s\" are mutually exclusive...";
    translations["ERROR_PARAM_NEEDED"] = "Param \"%1$s\" is required...";
    translations["ERROR_PARAM_ONLY_POSITIF"] = "Param \"%1$s\":
only positive value are authorized!";
    translations["ERROR_PARAM_ONLY_POSITIF_STRICT"] = "Param \"%1$s\":
only strict positive value are authorized!";
    translations["ERROR_PARAM_ONLY_NEGATIF"] = "Param \"%1$s\":
only negative value are authorized!";
    translations["ERROR_PARAM_ONLY_NEGATIF_STRICT"] = "Param \"%1$s\":
only strict negative value are authorized!";
    translations["ERROR_PARAM__valueBETWEEN"] = "Param \"%1$s\" (%2$f):
should be between %3$f and %4$f";
    translations["ERROR_PARAM_FOUND"] = "Error! Could not find property of \"%1$s\"";

    translations["MENU_FILE"] = "File";
    translations["MENU_FILE_OPEN"] = "Open";
    translations["MENU_FILE_OPEN_TIP"] = "Open a previous project";
    translations["MENU_FILE_CREATE"] = "New";
    translations["MENU_FILE_CREATE_TIP"] = "Create a new project";
    translations["MENU_FILE_SAVE"] = "Save";
    translations["MENU_FILE_SAVE_TIP"] = "Save current project";
    translations["MENU_FILE_SAVEAS"] = "Save as...";
    translations["MENU_FILE_SAVEAS_TIP"] = "Choose file where to save current project";
    translations["MENU_FILE_QUIT"] = "Quit";
    translations["MENU_FILE_QUIT_TIP"] = "Quit application";

    translations["MENU_EDIT"] = "Edit";
    translations["MENU_EDIT_SUBGRAPH"] = "Create subprocess";
    translations["MENU_EDIT_SUBGRAPH_TIP"] = "Create a subprocess using every selected widgets";

    translations["CREATE_PARAM_TITLE"] = "Parameter creation";
    translations["CREATE_PARAM_TYPE"] = "Type of the parameter: ";
    translations["CREATE_PARAM_NAME"] = "Short name of the parameter: ";
    translations["CREATE_PARAM_NAME_HELP"] = "Short description of the parameter: ";
    translations["CREATE_PARAM_INIT_VAL"] = "Initial value of the parameter: ";

    translations["MATRIX_EDITOR_TOOLS"] = "Tools";
    translations["MATRIX_EDITOR_BLOCKS"] = "Blocks";
    translations["MATRIX_EDITOR_DATA_CHOICES"] = "Matrix data type:";
    translations["MATRIX_EDITOR_DATA_SIZE"] = "Size (rows, cols, channels):";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL"] = "Initial values:";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_0"] = "zeros";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_1"] = "constant";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_2"] = "eye";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_3"] = "ellipse";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_4"] = "rect";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_5"] = "cross";
    translations["MATRIX_EDITOR_DATA_INITIAL_VAL_6"] = "random";
    translations["MATRIX_EDITOR_SECTION_PEN_COLOR"] = "Color:";
    translations["MATRIX_EDITOR_SECTION_PEN_SIZE"] = "Pencil size:";

    translations["MATRIX_EDITOR_HELP_LEFT"] = "Panning left (CTRL+arrowLEFT)";
    translations["MATRIX_EDITOR_HELP_RIGHT"] = "Panning right (CTRL+arrowRIGHT)";
    translations["MATRIX_EDITOR_HELP_UP"] = "Panning up (CTRL+arrowUP)";
    translations["MATRIX_EDITOR_HELP_DOWN"] = "Panning down (CTRL+arrowDOWN)";
    translations["MATRIX_EDITOR_HELP_ZOOM_X1"] = "Zoom x1 (CTRL+P)";
    translations["MATRIX_EDITOR_HELP_ZOOM_IN"] = "Zoom in (CTRL++)";
    translations["MATRIX_EDITOR_HELP_ZOOM_OUT"] = "Zoom out (CTRL+-)";
    translations["MATRIX_EDITOR_HELP_SAVE"] = "Save current matrix (CTRL+S)";
    translations["MATRIX_EDITOR_HELP_LOAD"] = "Load new matrix (CTRL+O)";
    translations["MATRIX_EDITOR_HELP_EDIT"] = "Edit matrix (CTRL+E)";
    translations["MATRIX_EDITOR_HELP_ONTOP"] = "Always on top (CTRL+T)";
    translations["MATRIX_EDITOR_HELP_START"] = "Run graph (Enter)";
    translations["MATRIX_EDITOR_HELP_STOP"] = "Stop graph (End)";
    translations["MATRIX_EDITOR_HELP_PAUSE"] = "Pause graph (Space)";

    translations["MENU_HELP_INFO"] = "Info";
    translations["MENU_HELP_HELP"] = "Help";

    translations["CONF_FILE_TYPE"] = "imGraph project (*.igp)";

    translations["PROJ_LOAD_FILE"] = "Open project file";
    translations["PROJ_CREATE_FILE"] = "Create project file";

    translations["DOCK_TITLE"] = "Toolbox";
    translations["DOCK_PROPERTY_TITLE"] = "Properties";

    translations["SUBBLOCK__"] = "Sub graph";

    translations["FOR_BLOCK_"] = "for";
    translations["FOR_BLOCK_INITVAL"] = "start";
    translations["FOR_BLOCK_INITVAL_HELP"] = "Initial value of counter";
    translations["FOR_BLOCK_ENDVAL"] = "end";
    translations["FOR_BLOCK_ENDVAL_HELP"] = "Final value of counter";
    translations["FOR_BLOCK_STEPVAL"] = "step";
    translations["FOR_BLOCK_STEPVAL_HELP"] = "Step value of counter";

    translations["BLOCK__INPUT_NAME"] = "File Loader";
    translations["BLOCK__INPUT_IN_INPUT_TYPE"] = "input";
    translations["BLOCK__INPUT_IN_INPUT_TYPE_HELP"] = "Input type|Webcam^Video file^Folder";
    translations["BLOCK__INPUT_IN_FILE_HELP"] = "File to load.";
    translations["BLOCK__INPUT_IN_FILE_FILTER"] = "media files";
    translations["BLOCK__INPUT_IN_FILE_NOT_FOUND"] = "File \"%1$s\" not found!";
    translations["BLOCK__INPUT_IN_FILE_NOT_FOLDER"] = "File \"%1$s\" is not a folder!";
    translations["BLOCK__INPUT_IN_FILE_PROBLEM"] = "File \"%1$s\" can't be loaded!";
    translations["BLOCK__INPUT_IN_LOOP"] = "loop";
    translations["BLOCK__INPUT_IN_LOOP_HELP"] = "Loop video file (if <=0, infinite loop)";
    translations["BLOCK__INPUT_IN_GREY"] = "grey";
    translations["BLOCK__INPUT_IN_GREY_HELP"] = "Convert image to a grayscale one";
    translations["BLOCK__INPUT_IN_COLOR"] = "color";
    translations["BLOCK__INPUT_IN_COLOR_HELP"] = "Convert image to a color one";
    translations["BLOCK__INPUT_OUT_IMAGE"] = "image";
    translations["BLOCK__INPUT_OUT_IMAGE_HELP"] = "Output image";
    translations["BLOCK__INPUT_OUT_FRAMERATE"] = "framerate";
    translations["BLOCK__INPUT_OUT_FRAMERATE_HELP"] = "Number of frames per second";
    translations["BLOCK__INPUT_INOUT_WIDTH"] = "width";
    translations["BLOCK__INPUT_INOUT_WIDTH_HELP"] = "Wanted width of images (in pixels)";
    translations["BLOCK__INPUT_INOUT_HEIGHT"] = "height";
    translations["BLOCK__INPUT_INOUT_HEIGHT_HELP"] = "Wanted height of images (in pixels)";
    translations["BLOCK__INPUT_INOUT_POS_FRAMES"] = "position";
    translations["BLOCK__INPUT_INOUT_POS_FRAMES_HELP"] = "0-based index of the frame to be decoded/captured";
    translations["BLOCK__INPUT_INOUT_POS_RATIO"] = "pos. ratio";
    translations["BLOCK__INPUT_INOUT_POS_RATIO_HELP"] = "Relative position in the video file (0-begining, 1-end)";
    translations["BLOCK__INPUT_OUT_FORMAT"] = "out format";
    translations["BLOCK__INPUT_OUT_FORMAT_HELP"] = "The format of the Mat objects";

    translations["BLOCK__OUTPUT_NAME"] = "Display image";
    translations["BLOCK__OUTPUT_IN_IMAGE"] = "image";
    translations["BLOCK__OUTPUT_IN_IMAGE_HELP"] = "Image to show";
    translations["BLOCK__OUTPUT_IN_WIN_NAME"] = "win. title";
    translations["BLOCK__OUTPUT_IN_WIN_NAME_HELP"] = "Windows title";
    translations["BLOCK__OUTPUT_IN_NORMALIZE"] = "normalize";
    translations["BLOCK__OUTPUT_IN_NORMALIZE_HELP"] = "Normalize image before show";

    translations["BLOCK__SHOWGRAPH_NAME"] = "Show graph";
    translations["BLOCK__SHOWGRAPH_IN_VALUES"] = "values";
    translations["BLOCK__SHOWGRAPH_IN_VALUES_HELP"] = "Vector of values to show";
    translations["BLOCK__SHOWGRAPH_IN_TITLE"] = "title";
    translations["BLOCK__SHOWGRAPH_IN_TITLE_HELP"] = "Graph title";

    translations["BLOCK__STRING_CREATION_NAME"] = "String creation";
    translations["BLOCK__STRING_CREATION_IN_REGEX"] = "pattern";
    translations["BLOCK__STRING_CREATION_IN_REGEX_HELP"] = "Pattern name
(use %i% for input i :
\"img%1%.jpg\"
 will concatenate first input
 with the pattern...)
%n% can also be used:
it's the number of current frame";
    translations["BLOCK__STRING_CREATION_OUT"] = "output";
    translations["BLOCK__STRING_CREATION_OUT_HELP"] = "Constructed string";

    translations["BLOCK__WRITE_NAME"] = "Write video";
    translations["BLOCK__WRITE_IN_IMAGE"] = "image";
    translations["BLOCK__WRITE_IN_IMAGE_HELP"] = "Image to add to video file";
    translations["BLOCK__WRITE_IN_FILENAME"] = "Filename";
    translations["BLOCK__WRITE_IN_FILENAME_HELP"] = "Filename of the video file";
    translations["BLOCK__WRITE_IN_FPS"] = "FPS";
    translations["BLOCK__WRITE_IN_FPS_HELP"] = "Frames per second";
    translations["BLOCK__WRITE_IN_CODEC"] = "codec";
    translations["BLOCK__WRITE_IN_CODEC_HELP"] = "FOURCC wanted (XVID, X264...).
Empty if you want no compression,
-1 if you want to choose using IHM!";

    translations["BLOCK__IMWRITE_NAME"] = "Write image";
    translations["BLOCK__IMWRITE_IN_IMAGE"] = "image";
    translations["BLOCK__IMWRITE_IN_IMAGE_HELP"] = "Image to save";
    translations["BLOCK__IMWRITE_IN_FILENAME"] = "Filename";
    translations["BLOCK__IMWRITE_IN_FILENAME_HELP"] = "Filename of the file";
    translations["BLOCK__IMWRITE_IN_QUALITY"] = "Quality";
    translations["BLOCK__IMWRITE_IN_QUALITY_HELP"] = "Quality of the output img (0->highest compression, 100->highest quality)";

    translations["BLOCK__LINEDRAWER_NAME"] = "Draw lines";
    translations["BLOCK__LINEDRAWER_IN_LINES"] = "lines list";
    translations["BLOCK__LINEDRAWER_IN_LINES_HELP"] = "Input of lines (4 values per row)";
    translations["BLOCK__LINEDRAWER_IN_IMAGE"] = "image";
    translations["BLOCK__LINEDRAWER_IN_IMAGE_HELP"] = "Input image to draw on";
    translations["BLOCK__LINEDRAWER_IN_COLOR"] = "color";
    translations["BLOCK__LINEDRAWER_IN_COLOR_HELP"] = "Color of lines";
    translations["BLOCK__LINEDRAWER_IN_SIZE"] = "size";
    translations["BLOCK__LINEDRAWER_IN_SIZE_HELP"] = "Size of lines";
    translations["BLOCK__LINEDRAWER_OUT_IMAGE"] = "image";
    translations["BLOCK__LINEDRAWER_OUT_IMAGE_HELP"] = "Binary output image";

    translations["BLOCK__POINTDRAWER_NAME"] = "Draw points";
    translations["BLOCK__POINTDRAWER_IN_POINTS"] = "point list";
    translations["BLOCK__POINTDRAWER_IN_POINTS_HELP"] = "Input of points (2 values per row)";
    translations["BLOCK__POINTDRAWER_IN_IMAGE"] = "image";
    translations["BLOCK__POINTDRAWER_IN_IMAGE_HELP"] = "Input image to draw on";
    translations["BLOCK__POINTDRAWER_IN_COLOR"] = "color";
    translations["BLOCK__POINTDRAWER_IN_COLOR_HELP"] = "Color of points";
    translations["BLOCK__POINTDRAWER_IN_SIZE"] = "size";
    translations["BLOCK__POINTDRAWER_IN_SIZE_HELP"] = "Size of points";
    translations["BLOCK__POINTDRAWER_OUT_IMAGE"] = "image";
    translations["BLOCK__POINTDRAWER_OUT_IMAGE_HELP"] = "Binary output image";
    translations["BLOCK__POINTDRAWER_ERROR_POINT_SIZE"] = "Image and points have different sizes";

    translations["BLOCK__CREATEMATRIX_NAME"] = "Create new matrix";
    translations["BLOCK__CREATEMATRIX_IN_TYPE"] = "type";
    translations["BLOCK__CREATEMATRIX_IN_TYPE_HELP"] = "Wanted type|CV_8U^CV_8S^CV_16U^CV_16S^CV_32S^CV_32F^CV_64F";
    translations["BLOCK__CREATEMATRIX_IN_NBCHANNEL"] = "channels";
    translations["BLOCK__CREATEMATRIX_IN_NBCHANNEL_HELP"] = "Numbers of channels";
    translations["BLOCK__CREATEMATRIX_IN_WIDTH"] = translations["BLOCK__INPUT_INOUT_WIDTH"];
    translations["BLOCK__CREATEMATRIX_IN_WIDTH_HELP"] = translations["BLOCK__INPUT_INOUT_WIDTH_HELP"];
    translations["BLOCK__CREATEMATRIX_IN_HEIGHT"] = translations["BLOCK__INPUT_INOUT_HEIGHT"];
    translations["BLOCK__CREATEMATRIX_IN_HEIGHT_HELP"] = translations["BLOCK__INPUT_INOUT_HEIGHT_HELP"];
    translations["BLOCK__CREATEMATRIX_IN_INIT"] = "intialisation";
    translations["BLOCK__CREATEMATRIX_IN_INIT_HELP"] = "Initial values of matrix|zeros^ones^eye^ellipse^rect^cross^random uniform^random gaussian";
    translations["BLOCK__CREATEMATRIX_OUT_IMAGE"] = "image";
    translations["BLOCK__CREATEMATRIX_OUT_IMAGE_HELP"] = "Binary output image";

    translations["BLOCK__NORMALIZ_NAME"] = "Normalize image";
    translations["BLOCK__NORMALIZ_IN_IMAGE"] = "image";
    translations["BLOCK__NORMALIZ_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__NORMALIZ_OUT_IMAGE"] = "image";
    translations["BLOCK__NORMALIZ_OUT_IMAGE_HELP"] = "Normalized image";

    translations["BLOCK__OPTICFLOW_NAME"] = "Compute Optical flow";
    translations["BLOCK__OPTICFLOW_IN_IMAGE1"] = "image1";
    translations["BLOCK__OPTICFLOW_IN_IMAGE1_HELP"] = "First image";
    translations["BLOCK__OPTICFLOW_IN_IMAGE2"] = "image2";
    translations["BLOCK__OPTICFLOW_IN_IMAGE2_HELP"] = "Second image";
    translations["BLOCK__OPTICFLOW_IN_METHOD"] = "method";
    translations["BLOCK__OPTICFLOW_IN_METHOD_HELP"] = "Method|LK^Farneback^DualTVL1^DeepFlow";
    translations["BLOCK__OPTICFLOW_OUT_IMAGE"] = "flow";
    translations["BLOCK__OPTICFLOW_OUT_IMAGE_HELP"] = "Optical flow";

    translations["BLOCK__LINE_FINDER_NAME"] = "Find lines";
    translations["BLOCK__LINE_FINDER_IN_IMAGE"] = "image";
    translations["BLOCK__LINE_FINDER_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__LINE_FINDER_OUT_IMAGE"] = "lines";
    translations["BLOCK__LINE_FINDER_OUT_IMAGE_HELP"] = "List of detected lines";

    translations["BLOCK__POINT_FINDER_NAME"] = "Find points";
    translations["BLOCK__POINT_FINDER_IN_IMAGE"] = "image";
    translations["BLOCK__POINT_FINDER_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__POINT_FINDER_IN_DETECTOR"] = "detector";
    translations["BLOCK__POINT_FINDER_IN_DETECTOR_HELP"] = "Method used to detect points|BRISK^FAST^GFTT^HARRIS^MSER^ORB^SIFT^STAR^SURF^KAZE^AKAZE^SimpleBlob"; //^Grid^Dense
    translations["BLOCK__POINT_FINDER_IN_EXTRACTOR"] = "extractor";
    translations["BLOCK__POINT_FINDER_IN_EXTRACTOR_HELP"] = "Method used to compute descriptor|SIFT^SURF^ORB^BRIEF^BRISK^MSER^FREAK^KAZE^AKAZE";
    translations["BLOCK__POINT_FINDER_OUT_DESC"] = "descriptors";
    translations["BLOCK__POINT_FINDER_OUT_DESC_HELP"] = "List of corresponding descriptors";
    translations["BLOCK__POINT_FINDER_OUT_POINTS"] = "points";
    translations["BLOCK__POINT_FINDER_OUT_POINTS_HELP"] = "List of detected points";

    translations["BLOCK__POINT_MATCHER_NAME"] = "Match points";
    translations["BLOCK__POINT_MATCHER_IN_PT_DESC1"] = "desc1";
    translations["BLOCK__POINT_MATCHER_IN_PT_DESC1_HELP"] = "List of first points descriptors";
    translations["BLOCK__POINT_MATCHER_IN_PT_DESC2"] = "desc2";
    translations["BLOCK__POINT_MATCHER_IN_PT_DESC2_HELP"] = "List of second points descriptors";
    translations["BLOCK__POINT_MATCHER_IN_ALGO"] = "method";
    translations["BLOCK__POINT_MATCHER_IN_ALGO_HELP"] = "Method used to match feature vector|Brute force^FLANN";
    translations["BLOCK__POINT_MATCHER_OUT_MATCHES"] = "matches";
    translations["BLOCK__POINT_MATCHER_OUT_MATCHES_HELP"] = "List of matched points";
    translations["BLOCK__POINT_MATCHER_OUT_MATCHES_MASK"] = "mask";
    translations["BLOCK__POINT_MATCHER_OUT_MATCHES_MASK_HELP"] = "List of correct matched points";

    translations["BLOCK__DEINTERLACE_NAME"] = "Deinterlace";
    translations["BLOCK__DEINTERLACE_IN_IMAGE"] = "image";
    translations["BLOCK__DEINTERLACE_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__DEINTERLACE_IN_TYPE"] = "Deinterlacing";
    translations["BLOCK__DEINTERLACE_IN_TYPE_HELP"] = "Deinterlacing type wanted|Blend^Bob^Discard^Unfold";
    translations["BLOCK__DEINTERLACE_OUT_IMAGE"] = "image";
    translations["BLOCK__DEINTERLACE_OUT_IMAGE_HELP"] = "Deinterlaced image";

    translations["BLOCK__HISTOGRAM_NAME"] = "Histogram";
    translations["BLOCK__HISTOGRAM_IN_IMAGE"] = "image";
    translations["BLOCK__HISTOGRAM_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__HISTOGRAM_IN_BINS"] = "#bins";
    translations["BLOCK__HISTOGRAM_IN_BINS_HELP"] = "number of bins";
    translations["BLOCK__HISTOGRAM_IN_ACCUMULATE"] = "accumulate";
    translations["BLOCK__HISTOGRAM_IN_ACCUMULATE_HELP"] = "This feature enables you to compute a single histogram from several sets of arrays, or to update the histogram in time";
    translations["BLOCK__HISTOGRAM_OUT_HISTO"] = "histo";
    translations["BLOCK__HISTOGRAM_OUT_HISTO_HELP"] = "Histogram of the input image";

    translations["BLOCK__SKIP_FRAME_NAME"] = "Keep only 1 frame every N frame";
    translations["BLOCK__SKIP_FRAME_IN_IMAGE"] = "image";
    translations["BLOCK__SKIP_FRAME_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__SKIP_FRAME_IN_TYPE"] = "nb skip";
    translations["BLOCK__SKIP_FRAME_IN_TYPE_HELP"] = "Number of frames to skip";
    translations["BLOCK__SKIP_FRAME_OUT_IMAGE"] = "image";
    translations["BLOCK__SKIP_FRAME_OUT_IMAGE_HELP"] = "Interlaced image";

    translations["BLOCK__DELAY_VIDEO_NAME"] = "Delay the video of N frame";
    translations["BLOCK__DELAY_VIDEO_IN_IMAGE"] = "image";
    translations["BLOCK__DELAY_VIDEO_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__DELAY_VIDEO_IN_DELAY"] = "delay";
    translations["BLOCK__DELAY_VIDEO_IN_DELAY_HELP"] = "Number of frames to delay";
    translations["BLOCK__DELAY_VIDEO_OUT_IMAGE"] = "image";
    translations["BLOCK__DELAY_VIDEO_OUT_IMAGE_HELP"] = "N-th old image";

    translations["BLOCK__ADD_NAME"] = "Add";
    translations["BLOCK__ADD_IN_PARAM1"] = "input1";
    translations["BLOCK__ADD_IN_PARAM1_HELP"] = "First input (Matrix, number...)";
    translations["BLOCK__ADD_IN_PARAM2"] = "input2";
    translations["BLOCK__ADD_IN_PARAM2_HELP"] = "Second input (Matrix, number...)";
    translations["BLOCK__ADD_OUTPUT"] = "sum";
    translations["BLOCK__ADD_OUTPUT_HELP"] = "Output sum of the two input (concatenate in case of string)";

    translations["BLOCK__CROP_NAME"] = "Crop image";
    translations["BLOCK__CROP_IN_IMAGE"] = "image";
    translations["BLOCK__CROP_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__CROP_WIDTH"] = translations["BLOCK__INPUT_INOUT_WIDTH"];
    translations["BLOCK__CROP_WIDTH_HELP"] = translations["BLOCK__INPUT_INOUT_WIDTH_HELP"];
    translations["BLOCK__CROP_HEIGHT"] = translations["BLOCK__INPUT_INOUT_HEIGHT"];
    translations["BLOCK__CROP_HEIGHT_HELP"] = translations["BLOCK__INPUT_INOUT_HEIGHT_HELP"];
    translations["BLOCK__CROP_IN_X"] = "X";
    translations["BLOCK__CROP_IN_X_HELP"] = "Position of top-left corner (X)";
    translations["BLOCK__CROP_IN_Y"] = "Y";
    translations["BLOCK__CROP_IN_Y_HELP"] = "Position of top-left corner (Y)";
    translations["BLOCK__CROP_OUT_IMAGE"] = "image";
    translations["BLOCK__CROP_OUT_IMAGE_HELP"] = "Croped image";

    translations["BLOCK__ACCUMULATOR_NAME"] = "Accumulator";
    translations["BLOCK__ACCUMULATOR_IN_IMAGE"] = "image";
    translations["BLOCK__ACCUMULATOR_IN_IMAGE_HELP"] = "Input image to accumulate";
    translations["BLOCK__ACCUMULATOR_IN_NB_HISTORY"] = "history";
    translations["BLOCK__ACCUMULATOR_IN_NB_HISTORY_HELP"] = "Size of accumulation history";
    translations["BLOCK__ACCUMULATOR_OUT_IMAGE"] = "image";
    translations["BLOCK__ACCUMULATOR_OUT_IMAGE_HELP"] = "Accumulated image";

    translations["BLOCK__MORPHOLOGIC_NAME"] = "Morpho math";
    translations["BLOCK__MORPHOLOGIC_IN_IMAGE"] = "image";
    translations["BLOCK__MORPHOLOGIC_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__MORPHOLOGIC_ELEMENT"] = "element";
    translations["BLOCK__MORPHOLOGIC_ELEMENT_HELP"] = "Structuring element.";
    translations["BLOCK__MORPHOLOGIC_OPERATOR"] = "op";
    translations["BLOCK__MORPHOLOGIC_OPERATOR_HELP"] = "Operator|open^close^gradient^tophat^blackhat";
    translations["BLOCK__MORPHOLOGIC_ITERATIONS"] = "iterations";
    translations["BLOCK__MORPHOLOGIC_ITERATIONS_HELP"] = "Number of times erosion and dilation are applied.";
    translations["BLOCK__MORPHOLOGIC_OUT_IMAGE"] = "image";
    translations["BLOCK__MORPHOLOGIC_OUT_IMAGE_HELP"] = "Filtered image";

    translations["BLOCK__CANNY_NAME"] = "Canny";
    translations["BLOCK__CANNY_IN_IMAGE"] = "image";
    translations["BLOCK__CANNY_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__CANNY_OUT_IMAGE"] = "output";
    translations["BLOCK__CANNY_OUT_IMAGE_HELP"] = "Canny image";
    translations["BLOCK__CANNY_IN_THRESHOLD_1"] = "Threshold 1";
    translations["BLOCK__CANNY_IN_THRESHOLD_1_HELP"] = "1er threshold for the hysteresis procedure";
    translations["BLOCK__CANNY_IN_THRESHOLD_2"] = "Threshold 2";
    translations["BLOCK__CANNY_IN_THRESHOLD_2_HELP"] = "2nd threshold for the hysteresis procedure";
    translations["BLOCK__CANNY_IN_APERTURE_SIZE"] = "Aperture Size";
    translations["BLOCK__CANNY_IN_APERTURE_SIZE_HELP"] = "aperture size for the Sobel operator";
    translations["BLOCK__CANNY_IN_L2_GRADIENT"] = "L2 Gradient";
    translations["BLOCK__CANNY_IN_L2_GRADIENT_HELP"] = "Use more accurate L2 gradient";

    translations["BLOCK__INPUT_IN_INPUT_FILE"] = "Input";
    translations["BLOCK__INPUT_IN_INPUT_FILE_HELP"] = "File Path";
    translations["BLOCK__INPUT_RAW_VIDEO_NAME"] = "YUV reader";

    translations["BLOCK__OUTPUT_RAW_VIDEO_NAME"] = "YUV writer";

    translations["BLOCK__CASCADECLASSIFIER_NAME"] = "Cascade Classifier";
    translations["BLOCK__CASCADECLASSIFIER_IN_IMAGE"] = "image";
    translations["BLOCK__CASCADECLASSIFIER_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__CASCADECLASSIFIER_OUT_IMAGE"] = "mask";
    translations["BLOCK__CASCADECLASSIFIER_OUT_IMAGE_HELP"] = "Output mask";
    translations["BLOCK__CASCADECLASSIFIER_IN_CASCADE_FILE"] = "classifier";
    translations["BLOCK__CASCADECLASSIFIER_IN_CASCADE_FILE_HELP"] = "Loads a classifier from a file.";
    translations["BLOCK__CASCADECLASSIFIER_IN_SCALE_FACTOR"] = "scaleFactor";
    translations["BLOCK__CASCADECLASSIFIER_IN_SCALE_FACTOR_HELP"] = "Parameter specifying how much the image size is reduced at each image scale.";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_NEIGHBORS"] = "minNeighbors";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_NEIGHBORS_HELP"] = "Parameter specifying how many neighbors each candidate rectangle should have to retain it.";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_WIDTH"] = "minWidth";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_WIDTH_HELP"] = "Minimum possible object width. Objects smaller than that are ignored.";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_HEIGHT"] = "minHeight";
    translations["BLOCK__CASCADECLASSIFIER_IN_MIN_HEIGHT_HELP"] = "Minimum possible object height. Objects smaller than that are ignored.";
    translations["BLOCK__CASCADECLASSIFIER_IN_MAX_WIDTH"] = "maxWidth";
    translations["BLOCK__CASCADECLASSIFIER_IN_MAX_WIDTH_HELP"] = "Maximum possible object width. Objects larger than that are ignored.";
    translations["BLOCK__CASCADECLASSIFIER_IN_MAX_HEIGHT"] = "maxHeight";
    translations["BLOCK__CASCADECLASSIFIER_IN_MAX_HEIGHT_HELP"] = "Maximum possible object height. Objects larger than that are ignored.";
    translations["BLOCK__CASCADECLASSIFIER_OUT_OBJECTS"] = "#objects";
    translations["BLOCK__CASCADECLASSIFIER_OUT_OBJECTS_HELP"] = "Number of detected objects";

    translations["BLOCK__BLUR_NAME"] = "Blurring";
    translations["BLOCK__BLUR_IN_METHOD"] = "method";
    translations["BLOCK__BLUR_IN_METHOD_HELP"] = "Blurring method|Mean^Gaussian^Median^Bilateral";
    translations["BLOCK__BLUR_IN_IMG"] = "image";
    translations["BLOCK__BLUR_IN_IMG_HELP"] = "Input image";
    translations["BLOCK__BLUR_OUT_IMAGE"] = "image";
    translations["BLOCK__BLUR_OUT_IMAGE_HELP"] = "Filtered image";

    translations["BLOCK__CONVERTMATRIX_NAME"] = "Convert matrix";
    translations["BLOCK__CONVERTMATRIX_IN_IMG"] = "image";
    translations["BLOCK__CONVERTMATRIX_IN_IMG_HELP"] = "Input image to convert";
    translations["BLOCK__CONVERTMATRIX_IN_TYPE"] = "type";
    translations["BLOCK__CONVERTMATRIX_IN_TYPE_HELP"] = "Wanted type|CV_8U^CV_8S^CV_16U^CV_16S^CV_32S^CV_32F^CV_64F";
    translations["BLOCK__CONVERTMATRIX_IN_NBCHANNEL"] = "channels";
    translations["BLOCK__CONVERTMATRIX_IN_NBCHANNEL_HELP"] = "Numbers of channels";
    translations["BLOCK__CONVERTMATRIX_OUT_IMAGE"] = "image";
    translations["BLOCK__CONVERTMATRIX_OUT_IMAGE_HELP"] = "Binary output image";

    translations["BLOCK__RESIZEMATRIX_NAME"] = "Resize matrix";
    translations["BLOCK__RESIZEMATRIX_IN_IMG"] = "image";
    translations["BLOCK__RESIZEMATRIX_IN_IMG_HELP"] = "Input image to resize";
    translations["BLOCK__RESIZEMATRIX_IN_WIDTH"] = translations["BLOCK__INPUT_INOUT_WIDTH"];
    translations["BLOCK__RESIZEMATRIX_IN_WIDTH_HELP"] = translations["BLOCK__INPUT_INOUT_WIDTH_HELP"];
    translations["BLOCK__RESIZEMATRIX_IN_HEIGHT"] = translations["BLOCK__INPUT_INOUT_HEIGHT"];
    translations["BLOCK__RESIZEMATRIX_IN_HEIGHT_HELP"] = translations["BLOCK__INPUT_INOUT_HEIGHT_HELP"];
    translations["BLOCK__RESIZEMATRIX_OUT_IMAGE"] = "image";
    translations["BLOCK__RESIZEMATRIX_OUT_IMAGE_HELP"] = "Binary output image";

    translations["BLOCK__CORE_NAME"] = "CORE filter";
    translations["BLOCK__CORE_IN_POINTS"] = "points";
    translations["BLOCK__CORE_IN_POINTS_HELP"] = "Input points to filter";
    translations["BLOCK__CORE_IN_DESC"] = "descriptors";
    translations["BLOCK__CORE_IN_DESC_HELP"] = "Input descriptors to filter";
    translations["BLOCK__CORE_IN_THRESHOLD"] = "threshold";
    translations["BLOCK__CORE_IN_THRESHOLD_HELP"] = "Threshold value (percent)";
    translations["BLOCK__CORE_IN_OPTIM_THRESHOLD"] = "optimization";
    translations["BLOCK__CORE_IN_OPTIM_THRESHOLD_HELP"] = "Threshold value of optimization (0->1, 1 for no optimization)";
    translations["BLOCK__CORE_OUT_POINTS"] = "points";
    translations["BLOCK__CORE_OUT_POINTS_HELP"] = "Filtered points";
    translations["BLOCK__CORE_OUT_DESC"] = "descriptors";
    translations["BLOCK__CORE_OUT_DESC_HELP"] = "Filtered descriptors";

    translations["BLOCK__FILTER2D_NAME"] = "Filter2D";
    translations["BLOCK__FILTER2D_IN_IMAGE"] = "image";
    translations["BLOCK__FILTER2D_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__FILTER2D_IN_KERNEL"] = "kernel";
    translations["BLOCK__FILTER2D_IN_KERNEL_HELP"] = "Convolution kernel ";
    translations["BLOCK__FILTER2D_OUT_IMAGE"] = "image";
    translations["BLOCK__FILTER2D_OUT_IMAGE_HELP"] = "Output image";

    translations["BLOCK__LAPLACIAN_NAME"] = "Laplacian";
    translations["BLOCK__LAPLACIAN_IN_IMAGE"] = "image";
    translations["BLOCK__LAPLACIAN_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__LAPLACIAN_OUT_IMAGE"] = "image";
    translations["BLOCK__LAPLACIAN_OUT_IMAGE_HELP"] = "Output image";

    translations["BLOCK__MASKDRAWER_NAME"] = "Draw mask";
    translations["BLOCK__MASKDRAWER_IN_IMAGE"] = "image";
    translations["BLOCK__MASKDRAWER_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__MASKDRAWER_IN_MASK"] = "mask";
    translations["BLOCK__MASKDRAWER_IN_MASK_HELP"] = "Input mask";
    translations["BLOCK__MASKDRAWER_IN_PRINTMASK"] = "Masking type";
    translations["BLOCK__MASKDRAWER_IN_PRINTMASK_HELP"] = "How to use the mask?|Draw mask^Keep only mask";
    translations["BLOCK__MASKDRAWER_OUT_IMAGE"] = "image";
    translations["BLOCK__MASKDRAWER_OUT_IMAGE_HELP"] = "Output image";
    translations["BLOCK__MASKDRAWER_ERROR_MASK_TYPE"] = "Expected mask of type CV_8UC1";
    translations["BLOCK__MASKDRAWER_ERROR_DIFF_SIZE"] = "Image and mask have different sizes";

    translations["BLOCK__THINNING_NAME"] = "Thinning img";
    translations["BLOCK__THINNING_IN_IMAGE"] = "image";
    translations["BLOCK__THINNING_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__THINNING_OUT_IMAGE"] = "image";
    translations["BLOCK__THINNING_OUT_IMAGE_HELP"] = "Output image";

    translations["BLOCK__DISTANCE_NAME"] = "Distance transform";
    translations["BLOCK__DISTANCE_IN_IMAGE"] = "image";
    translations["BLOCK__DISTANCE_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__DISTANCE_IN_DISTANCETYPE"] = "distance";
    translations["BLOCK__DISTANCE_IN_DISTANCETYPE_HELP"] = "distance type|DIST_C^DIST_L1^DIST_L2^DIST_PRECISE";
    translations["BLOCK__DISTANCE_OUT_IMAGE"] = "image";
    translations["BLOCK__DISTANCE_OUT_IMAGE_HELP"] = "Output image";

    translations["BLOCK__BINARIZE_NAME"] = "Binarize img";
    translations["BLOCK__BINARIZE_IN_IMAGE"] = "image";
    translations["BLOCK__BINARIZE_IN_IMAGE_HELP"] = "Input image";
    translations["BLOCK__BINARIZE_IN_INVERSE"] = "inverse";
    translations["BLOCK__BINARIZE_IN_INVERSE_HELP"] = "Use inverse of binary image";
    translations["BLOCK__BINARIZE_IN_METHOD"] = "Method";
    translations["BLOCK__BINARIZE_IN_METHOD_HELP"] = "Binarization method|Simple threshold^Otsu^Adaptative^Sauvola";
    translations["BLOCK__BINARIZE_IN_THRESHOLD"] = "threshold";
    translations["BLOCK__BINARIZE_IN_THRESHOLD_HELP"] = "Threshold value";
    translations["BLOCK__BINARIZE_OUT_IMAGE"] = "image";
    translations["BLOCK__BINARIZE_OUT_IMAGE_HELP"] = "Output image";

  }
}

ext: cpp

max_stars_repo_name: Petititi/imGraph

max_issues_repo_name: Petititi/imGraph

max_forks_repo_name: Petititi/imGraph


text:
/**
 * @author  David Sidler <david.sidler@inf.ethz.ch>
 * (c) 2017, ETH Zurich, Systems Group
 *
 */

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include <chrono>
#include <thread>
#include <random>
#include <vector>
#include <algorithm>

#include <fpga/Fpga.h>
#include <communication/Communicator.h>
#include <communication/HardRoceCommunicator.h>

#include <boost/program_options.hpp>

using namespace std::chrono_literals;

static unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();

void fillRandomData(uint64_t* block, uint64_t size) {
   std::default_random_engine rand_gen(seed);
   std::uniform_int_distribution<int> distr(0, std::numeric_limits<std::uint32_t>::max());

   uint64_t* uPtr = block;
   for (uint64_t i = 0; i < size-7; i += 8) {
      *uPtr = distr(rand_gen);
      uPtr++;
   }
}

int main(int argc, char *argv[]) {

   //command line arguments

   boost::program_options::options_description programDescription("Allowed options");
   programDescription.add_options()("size,s", boost::program_options::value<uint64_t>(), "Transfer size in bytes")
                                    ("repetitions,r", boost::program_options::value<uint32_t>(), "Number of repetitions")
                                    ("messages,m", boost::program_options::value<uint32_t>(), "Number of messages")
                                    ("address", boost::program_options::value<std::string>(), "master ip address")
                                    ("warmup,w", boost::program_options::value<bool>(), "run warm up")
                                    ("isWrite", boost::program_options::value<bool>(), "operation");

   boost::program_options::variables_map commandLineArgs;
   boost::program_options::store(boost::program_options::parse_command_line(argc, argv, programDescription), commandLineArgs);
   boost::program_options::notify(commandLineArgs);

   int32_t numberOfNodes = 2;
	int32_t nodeId = 0;
   uint64_t transferSize = 0;
   uint32_t numberRepetitions = 1;
   uint32_t numberOfMessages = 10;
   const char* masterAddr = nullptr;
   bool runWarmUp = true;
   bool isWrite = true;

   if (commandLineArgs.count("size") > 0) {
      transferSize = commandLineArgs["size"].as<uint64_t>();
   } else {
      std::cerr << "argument missing";
      return 1;
   }
   if (commandLineArgs.count("repetitions") > 0) {
      numberRepetitions = commandLineArgs["repetitions"].as<uint32_t>();
   }

   if (commandLineArgs.count("messages") > 0) {
      numberOfMessages = commandLineArgs["messages"].as<uint32_t>();
   }
   if (commandLineArgs.count("warmup") > 0) {
      runWarmUp = commandLineArgs["warmup"].as<bool>();
   }
   if (commandLineArgs.count("isWrite") > 0) {
      isWrite = commandLineArgs["isWrite"].as<bool>();
   }

   std::cout << "tranferSize " << transferSize << std::endl;
   if (isWrite) {
      std::cout << "Running write benchmark" << std::endl;
   } else {
      std::cout << "Running read benchmark" << std::endl;
   }

   if (commandLineArgs.count("address") > 0) {
      nodeId = 1;
      masterAddr = commandLineArgs["address"].as<std::string>().c_str();
      std::cout << "master: " << masterAddr << std::endl;
   }

   fpga::Fpga::setNodeId(nodeId);
   fpga::Fpga::initializeMemory();

   communication::HardRoceCommunicator* communicator = new communication::HardRoceCommunicator(fpga::Fpga::getController(), nodeId, numberOfNodes, 1, masterAddr);

   //Setup buffers and exchange windows
   uint64_t allocSize = transferSize;
   allocSize *= 2;

   uint64_t* dmaBuffer =  (uint64_t*) fpga::Fpga::allocate(allocSize);
   communication::RoceWin* window = (communication::RoceWin*) calloc(1, sizeof(communication::RoceWin));
   communicator->exchangeWindow(dmaBuffer, allocSize, window);

   //sender
   double durationUs = 0.0;
   std::vector<double> durations;

   if (nodeId == 1) {

      fillRandomData(dmaBuffer, transferSize);
      if (!isWrite) {
         communicator->put(dmaBuffer, transferSize, 0, 0, 0, window);
      }
      volatile uint64_t* pollPtr = dmaBuffer;
      if (isWrite) {
         pollPtr += (transferSize/sizeof(uint64_t));
      } else {
         pollPtr += (allocSize/sizeof(uint64_t));
         pollPtr--;
      }

      for (uint32_t r = 0; r < numberRepetitions+1; ++r) {
         if (r == 0) {
            if (!runWarmUp) {
               continue;
            }
            std::cout << "Warm up..." << std::endl;
         } else {
            std::cout << "Repetition: " << r <<  "/" << numberRepetitions << std::endl;
         }

         memset((void*) pollPtr, 0, 64);

         std::this_thread::sleep_for(5s);
         auto start = std::chrono::high_resolution_clock::now();
         if (isWrite) {
            for (uint32_t m = 0; m < numberOfMessages-1; ++m) {
               communicator->put(dmaBuffer, transferSize, 0, 0, 0, window);
            }
            //last message triggers other side to reply
            uint64_t targetOffset = transferSize;
            communicator->put(dmaBuffer, transferSize, 0, 0, targetOffset, window);
         } else {
            for (uint32_t m = 0; m < numberOfMessages-1; ++m) {
               communicator->get(dmaBuffer, transferSize, 0, 0, 0, window);
            }
            //last message triggers other side to reply
            uint64_t targetOffset = transferSize;
            communicator->get(dmaBuffer, transferSize, transferSize, 0, 0, window);

         }

         while(*pollPtr == 0) {};
         auto end = std::chrono::high_resolution_clock::now();
         durationUs = (std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count() / 1000.0);

         if (r != 0) {
            durations.push_back(durationUs);
         }
      }

   } else { //receiver

      volatile uint64_t* pollPtr = dmaBuffer;
      pollPtr += ((allocSize)/sizeof(uint64_t));
      --pollPtr;

      if (isWrite) {
         for (uint32_t r = 0; r < numberRepetitions+1; ++r) {
            if (r == 0 && !runWarmUp) {
               continue;
            }
            //busy polling
            while (*pollPtr == 0);
            //send back
            communicator->put(dmaBuffer, 8, 0, 1, transferSize, window);

            std::this_thread::sleep_for(1s);
            memset(dmaBuffer, 0, allocSize);
         }
      } else {
         while (*pollPtr == 0);
      }
   }

   if (nodeId == 1) {
      //release the other node
      if (!isWrite) {
         uint64_t targetOffset = transferSize;
         communicator->put(dmaBuffer, transferSize, 0, 0, targetOffset, window);

         //Check correctness
         /*bool correct = true;
         for (uint32_t j = 0; j < transferSize; ++j) {
            if (
         }
         if (correct) {
            std::cout << "RESULT CORRECT " << std::dec << bytesTested << " bytres tested." << std::endl;
         }*/
      }

      //Get stats
      double totalDurationUs = 0.0;
      for (uint32_t r = 0; r < numberRepetitions; ++r) {
         totalDurationUs += durations[r];
      }
      double avgDurationUs = totalDurationUs / (double) numberRepetitions;
      double messageRate =  (((double) numberOfMessages) / avgDurationUs);
      double stddev = 0.0;
      for (uint32_t r = 0; r < numberRepetitions; ++r) {
         double thisMessageRate = ((double) numberOfMessages) / durations[r];
         stddev += ((thisMessageRate - messageRate) * (thisMessageRate - messageRate));
      }
      stddev /= numberRepetitions;

      std::cout << "Size[B]: " << std::dec << transferSize << std::endl;
      std::cout << "Messages: " << std::dec << numberOfMessages << std::endl;
      std::cout << "Duration[us]: " << avgDurationUs << std::endl;
      std::cout << "Message rate [Msg/us]: " << messageRate << std::endl;
      std::cout << std::fixed << "Message rate [Msg/s]: " << (messageRate * 1000.0 * 1000.0) << std::endl;
      std::cout << "Stddev: " <<stddev << std::endl;

      std::cout << "#" << transferSize << "\t" << messageRate  << "\t" << stddev << std::endl;
   }

	fpga::Fpga::getController()->printDebugRegs();
   fpga::Fpga::getController()->printDmaStatsRegs();

   fpga::Fpga::free(dmaBuffer);
   fpga::Fpga::clear();

	return 0;

}

max_stars_repo_name: WukLab/davos

max_issues_repo_name: WukLab/davos

max_forks_repo_name: WukLab/davos


text:
//==================================================================================================
/*!
  @file

  @copyright 2016 NumScale SAS

  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

**/
//==================================================================================================
#ifndef BOOST_SIMD_META_IS_LOGICAL_MASK_HPP_INCLUDED
#define BOOST_SIMD_META_IS_LOGICAL_MASK_HPP_INCLUDED

#include <boost/simd/config.hpp>
#include <boost/simd/meta/is_bitwise_logical.hpp>

namespace boost { namespace simd
{
  namespace bd = boost::dispatch;
  namespace bs = boost::simd;

/*!
  @brief Is a SIMD vector both bitwise_logical and contain either all 0 or ~0.

  This metafunction represents a subset of is_bitwise_logical and returns true
  if the same SIMD registers are used by both arithmetic and logical vectors and
  if logical vectors are represented by either all 0 or ~0. This is assumed to be
  true - otherwise overloads must be provided on architectures where logical types
  are bitwise_logical but do not contain either all 0 or ~0 - for example qpx.

  @par semantic
   boost::simd::meta::is_logical_mask<T>::value = true/false

  @param T - a SIMD register on the target architecture
*/

  template<typename T > struct is_logical_mask : is_bitwise_logical<T> {};
} }

#endif

max_stars_repo_name: SylvainCorlay/pythran

max_issues_repo_name: SylvainCorlay/pythran

max_forks_repo_name: SylvainCorlay/pythran


text:
/********************************************************************************
 * Copyright 2009 The Robotics Group, The Maersk Mc-Kinney Moller Institute,
 * Faculty of Engineering, University of Southern Denmark
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ********************************************************************************/

#ifndef RW_KINEMATICS_FKTABLE_HPP
#define RW_KINEMATICS_FKTABLE_HPP

/**
 * @file FKTable.hpp
 */
#if !defined(SWIG)
#include "FrameMap.hpp"
#include "State.hpp"

#include <rw/math/Transform3D.hpp>
#endif
/*
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index_container.hpp>
*/

namespace rw { namespace kinematics {

    class Frame;

    /** @addtogroup kinematics */
    /*@{*/

    /**
     * @brief Forward kinematics for a set of frames.
     *
     * FKTable finds transforms for frames for a given fixed work cell state.
     * The frame transforms are calculated relative to the world frame.
     */
    class FKTable
    {
      public:
        /**
         * @brief Forward kinematics for the work cell state \b state.
         *
         * @param state [in] The work state for which world transforms are to be
         * calculated.
         */
        FKTable (const rw::kinematics::State& state);
#if !defined(SWIGPYTHON) && !defined(SWIGJAVA) && !defined(SWIGLUA)
        /**
         * @brief Forward kinematics for the work cell state \b state.
         * @param state [in] The work state for which world transforms are to be
         * calculated.
         */
        FKTable (const rw::kinematics::State* state);
#endif
        /**
         * @brief The world transform for the frame \b frame.
         *
         * @param frame [in] The frame for which to find the world transform.
         *
         * @return The transform of the frame relative to the world.
         */
        const rw::math::Transform3D<>& get (const rw::kinematics::Frame& frame) const;

        //! @copydoc get(const Frame&) const
        inline const rw::math::Transform3D<>& get (const rw::kinematics::Frame* frame) const { return get (*frame); }

        /**
         * @brief Returns State associated with the FKTable
         *
         * The State returned is the State used to calculate the forward kinematics.
         *
         * @return State used to calculate the forward kinematics
         */
        const rw::kinematics::State& getState () const { return *_sp; }

        /**
         * @brief resets the FKTable to \b state
         * @param state
         */
        void reset (const rw::kinematics::State& state);

      private:
        const State* _sp;
        State _state;

        typedef FrameMap< math::Transform3D<> > TransformMap;

        mutable TransformMap _transforms;

      private:
        FKTable (const FKTable&);
    };

    /*@}*/
}}    // namespace rw::kinematics

#endif    // end include guard


text:
/*
 * Copyright (c) 2020-2022 The reone project contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#include <boost/test/unit_test.hpp>

#include "../../src/common/unicodeutil.h"

using namespace std;

using namespace reone;

BOOST_AUTO_TEST_SUITE(unicode_utils)

BOOST_AUTO_TEST_CASE(should_convert_utf8_to_utf16) {
    // given
    auto expected = u16string(u"Hello, world!");

    // when
    auto actual = convertUTF8ToUTF16(string("Hello, world!"));

    // then
    BOOST_CHECK(expected == actual);
}

BOOST_AUTO_TEST_CASE(should_convert_utf16_to_utf8) {
    // given
    auto expected = string("Hello, world!");

    // when
    auto actual = convertUTF16ToUTF8(u16string(u"Hello, world!"));

    // then
    BOOST_CHECK_EQUAL(expected, actual);
}

BOOST_AUTO_TEST_SUITE_END()

max_stars_repo_name: seedhartha/revan

max_issues_repo_name: seedhartha/revan

max_forks_repo_name: seedhartha/revan