text:
//---------------------------------------------------------------------------//
// Copyright (c) 2020-2021 Mikhail Komarov <nemo@nil.foundation>
// Copyright (c) 2020-2021 Nikita Kaskov <nbering@nil.foundation>
// Copyright (c) 2021 Aleksei Moskvin <alalmoskvin@gmail.com>
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//---------------------------------------------------------------------------//

#ifndef MARSHALLING_ALGORITHMS_PACK_HPP
#define MARSHALLING_ALGORITHMS_PACK_HPP

#include <type_traits>

#include <nil/marshalling/type_traits.hpp>
#include <nil/marshalling/inference.hpp>
#include <nil/detail/pack_value.hpp>
#include <nil/detail/type_traits.hpp>

#include <boost/container/static_vector.hpp>
#include <boost/concept/requires.hpp>
#include <boost/range/concepts.hpp>

namespace nil {
    namespace marshalling {
        /*!
         * @defgroup marshalling Marshalling
         *
         * @brief Marshalling between two or more defined types
         *
         * @defgroup marshalling_algorithms Algorithms
         * @ingroup marshalling
         * @brief Algorithms are meant to provide marshalling interface similar to STL algorithms' one.
         */

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam SinglePassRange
         *
         * @param r
         *
         * @return
         */
        template<typename TEndian, typename SinglePassRange>
        typename std::enable_if<std::is_integral<typename SinglePassRange::value_type>::value,
                                nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>>::type
            pack(const SinglePassRange &r) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            status_type s;
            return nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>(r, s);
        }

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam SinglePassRange
         *
         * @param r
         * @param status
         *
         * @return
         */
        template<typename TEndian, typename SinglePassRange>
        typename std::enable_if<nil::detail::is_range<SinglePassRange>::value &&
                                std::is_integral<typename SinglePassRange::value_type>::value,
                                nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>>::type
            pack(const SinglePassRange &r, status_type &status) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            return nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>(r, status);
        }
        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam SinglePassRange
         *
         * @param r
         *
         * @return
         */
        template<typename TEndian, typename SinglePassRange>
        typename std::enable_if<nil::detail::is_range<SinglePassRange>::value
                                    && std::is_integral<typename SinglePassRange::value_type>::value,
                                nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>>::type
            pack(const SinglePassRange &r) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            status_type s;
            return nil::detail::range_pack_impl<TEndian, typename SinglePassRange::const_iterator>(r, s);
        }

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam InputIterator
         *
         * @param first
         * @param last
         * @param status
         *
         * @return
         */

        template<typename TEndian, typename InputIterator>
        typename std::enable_if<
            nil::detail::is_iterator<InputIterator>::value
                && std::is_integral<typename std::iterator_traits<InputIterator>::value_type>::value,
            nil::detail::range_pack_impl<TEndian, InputIterator>>::type
            pack(InputIterator first, InputIterator last, status_type &status) {
            BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<InputIterator>));
            return nil::detail::range_pack_impl<TEndian, InputIterator>(first, last, status);
        }

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam InputIterator
         *
         * @param first
         * @param last
         * @param status
         *
         * @return
         */

        template<typename TEndian, typename InputIterator>
        typename std::enable_if<
            nil::detail::is_iterator<InputIterator>::value
                && std::is_integral<typename std::iterator_traits<InputIterator>::value_type>::value,
            nil::detail::range_pack_impl<TEndian, InputIterator>>::type
            pack(InputIterator first, InputIterator last) {
            BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<InputIterator>));
            status_type s;
            return nil::detail::range_pack_impl<TEndian, InputIterator>(first, last, s);
        }

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam SinglePassRange
         * @tparam OutputIterator
         *
         * @param r
         * @param out
         * @param status
         *
         * @return
         */
        template<typename TEndian, typename SinglePassRange, typename OutputIterator>
        typename std::enable_if<
            nil::detail::is_range<SinglePassRange>::value
                && std::is_integral<typename SinglePassRange::value_type>::value
                && nil::detail::is_iterator<OutputIterator>::value,
            nil::detail::itr_pack_impl<TEndian, typename SinglePassRange::const_iterator, OutputIterator>>::type
            pack(const SinglePassRange &r, OutputIterator out, status_type &status) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            return nil::detail::itr_pack_impl<TEndian, typename SinglePassRange::const_iterator, OutputIterator>(
                r, std::move(out), status);
        }

        /*!
         * @brief
         *
         * @ingroup marshalling_algorithms
         *
         * @tparam TEndian
         * @tparam SinglePassRange
         * @tparam OutputIterator
         *
         * @param r
         * @param out
         * @param status
         *
         * @return
         */
        template<typename TEndian, typename SinglePassRange, typename OutputIterator>
        typename std::enable_if<
            nil::detail::is_iterator<OutputIterator>::value && nil::detail::is_range<SinglePassRange>::value
                && std::is_integral<typename SinglePassRange::value_type>::value
                && nil::detail::is_iterator<OutputIterator>::value,
            nil::detail::itr_pack_impl<TEndian, typename SinglePassRange::const_iterator, OutputIterator>>::type
            pack(const SinglePassRange &r, OutputIterator out) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            status_type s;
            return nil::detail::itr_pack_impl<TEndian, typename SinglePassRange::const_iterator, OutputIterator>(
                r, std::move(out), s);
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam InputIterator
         * @tparam OutputIterator
         * @param first
         * @param last
         * @param out
         * @param status
         * @return
         */
        template<typename TEndian, typename InputIterator, typename OutputIterator>
        typename std::enable_if<nil::detail::is_iterator<InputIterator>::value
                                    && std::is_integral<typename std::iterator_traits<InputIterator>::value_type>::value
                                    && nil::detail::is_iterator<OutputIterator>::value,
                                nil::detail::itr_pack_impl<TEndian, InputIterator, OutputIterator>>::type
            pack(InputIterator first, InputIterator last, OutputIterator out, status_type &status) {
            return nil::detail::itr_pack_impl<TEndian, InputIterator, OutputIterator>(first, last, std::move(out),
                                                                                status);
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam InputIterator
         * @tparam OutputIterator
         * @param first
         * @param last
         * @param out
         * @return
         */
        template<typename TEndian, typename InputIterator, typename OutputIterator>
        typename std::enable_if<nil::detail::is_iterator<InputIterator>::value
                                    && std::is_integral<typename std::iterator_traits<InputIterator>::value_type>::value
                                    && nil::detail::is_iterator<OutputIterator>::value,
                                status_type>::type
            pack(InputIterator first, InputIterator last, OutputIterator out) {
            BOOST_CONCEPT_ASSERT(
                (boost::OutputIteratorConcept<OutputIterator,
                                              typename std::iterator_traits<OutputIterator>::value_type>));
            status_type status;
            status = nil::detail::itr_pack_impl<TEndian, InputIterator, OutputIterator>(first, last, std::move(out),
                                                                                status);
            return status;
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam SinglePassRange1
         * @tparam SinglePassRange2
         * @param rng_input
         * @param rng_output
         * @return
         */
        template<typename TEndian, typename SinglePassRange1, typename SinglePassRange2>
        typename std::enable_if<nil::detail::is_range<SinglePassRange1>::value
                                    && nil::detail::is_range<SinglePassRange2>::value
                                    && !nil::detail::is_array<SinglePassRange2>::value,
                                status_type>::type
            pack(const SinglePassRange1 &rng_input, SinglePassRange2 &rng_output) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange1>));
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange2>));
            status_type status;
            std::vector<typename SinglePassRange2::value_type> v = pack<TEndian>(rng_input, status);
            rng_output = SinglePassRange2(v.begin(), v.end());
            return status;
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam SinglePassRange
         * @tparam TOutput
         * @param rng_input
         * @param rng_output
         * @return
         */
        template<typename TEndian, typename SinglePassRange, typename TOutput>
        typename std::enable_if<!(nil::detail::is_range<TOutput>::value || nil::detail::is_iterator<TOutput>::value)
                                 || nil::detail::is_array<TOutput>::value,
                                status_type>::type
            pack(const SinglePassRange &rng_input, TOutput &rng_output) {
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            status_type status;
            rng_output = pack<TEndian>(rng_input, status);
            return status;
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam InputIterator
         * @tparam SinglePassRange
         * @param first
         * @param last
         * @param rng_output
         * @return
         */
        template<typename TEndian, typename InputIterator, typename SinglePassRange>
        typename std::enable_if<nil::detail::is_iterator<InputIterator>::value
                                    && nil::detail::is_range<SinglePassRange>::value
                                    && !(nil::detail::is_array<SinglePassRange>::value),
                                status_type>::type
            pack(InputIterator first, InputIterator last, SinglePassRange &rng_output) {
            BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<InputIterator>));
            BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<const SinglePassRange>));
            status_type status;
            std::vector<typename SinglePassRange::value_type> v = pack<TEndian>(first, last, status);
            rng_output = SinglePassRange(v.begin(), v.end());
            return status;
        }

        /*!
         * @brief
         * @tparam TEndian
         * @tparam InputIterator
         * @tparam TOutput
         * @param first
         * @param last
         * @param rng_output
         * @return
         */
        template<typename TEndian, typename InputIterator, typename TOutput>
        typename std::enable_if<nil::detail::is_iterator<InputIterator>::value && !nil::detail::is_range<TOutput>::value
                                || nil::detail::is_array<TOutput>::value,
                                status_type>::type
            pack(InputIterator first, InputIterator last, TOutput &rng_output) {
            BOOST_CONCEPT_ASSERT((boost::InputIteratorConcept<InputIterator>));
            status_type status;
            rng_output = pack<TEndian>(first, last, status);
            return status;
        }
    }    // namespace marshalling
}    // namespace nil

#endif    // MARSHALLING_MARSHALL_NEW_HPP

max_stars_repo_name: NilFoundation/marshalling

max_issues_repo_name: NilFoundation/marshalling

max_forks_repo_name: NilFoundation/marshalling


text:
//
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
//    names, trademarks, service marks, or product names of the Licensor
//    and its affiliates, except as required to comply with Section 4(c) of
//    the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "pxr/imaging/glf/simpleLight.h"

#include <boost/python/class.hpp>

using namespace boost::python;

void wrapSimpleLight()
{
    typedef GlfSimpleLight This;

    class_<This> ("SimpleLight", init<>() )
        .add_property("transform",
                      make_function(
                          &This::GetTransform,
                          return_value_policy<return_by_value>()),
                      &This::SetTransform)
        .add_property("ambient",
                      make_function(
                          &This::GetAmbient,
                          return_value_policy<return_by_value>()),
                      &This::SetAmbient)
        .add_property("diffuse",
                      make_function(
                          &This::GetDiffuse,
                          return_value_policy<return_by_value>()),
                      &This::SetDiffuse)
        .add_property("specular",
                      make_function(
                          &This::GetSpecular,
                          return_value_policy<return_by_value>()),
                      &This::SetSpecular)
        .add_property("position",
                      make_function(
                          &This::GetPosition,
                          return_value_policy<return_by_value>()),
                      &This::SetPosition)
        .add_property("spotDirection",
                      make_function(
                          &This::GetSpotDirection,
                          return_value_policy<return_by_value>()),
                      &This::SetSpotDirection)
        .add_property("spotCutoff",
                      make_function(
                          &This::GetSpotCutoff,
                          return_value_policy<return_by_value>()),
                      &This::SetSpotCutoff)
        .add_property("spotFalloff",
                      make_function(
                          &This::GetSpotFalloff,
                          return_value_policy<return_by_value>()),
                      &This::SetSpotFalloff)
        .add_property("attenuation",
                      make_function(
                          &This::GetAttenuation,
                          return_value_policy<return_by_value>()),
                      &This::SetAttenuation)
        .add_property("shadowMatrix",
                      make_function(
                          &This::GetShadowMatrix,
                          return_value_policy<return_by_value>()),
                      &This::SetShadowMatrix)
        .add_property("shadowResolution",
                      make_function(
                          &This::GetShadowResolution,
                          return_value_policy<return_by_value>()),
                      &This::SetShadowResolution)
        .add_property("shadowBias",
                      make_function(
                          &This::GetShadowBias,
                          return_value_policy<return_by_value>()),
                      &This::SetShadowBias)
        .add_property("shadowBlur",
                      make_function(
                          &This::GetShadowBlur,
                          return_value_policy<return_by_value>()),
                      &This::SetShadowBlur)
        .add_property("shadowIndex",
                      make_function(
                          &This::GetShadowIndex,
                          return_value_policy<return_by_value>()),
                      &This::SetShadowIndex)
        .add_property("hasShadow",
                      make_function(
                          &This::HasShadow,
                          return_value_policy<return_by_value>()),
                      &This::SetHasShadow)
        .add_property("isCameraSpaceLight",
                      make_function(
                          &This::IsCameraSpaceLight,
                          return_value_policy<return_by_value>()),
                      &This::SetIsCameraSpaceLight)
        .add_property("id",
                      make_function(
                          &This::GetID,
                          return_value_policy<return_by_value>()),
                      &This::SetID)
        ;
}

ext: cpp

max_stars_repo_name: marsupial/USD

max_issues_repo_name: marsupial/USD

max_forks_repo_name: marsupial/USD


text:
#include "App/config.h"

#include <pwd.h>
#include <sys/types.h>

#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <iostream>

using namespace std;

void tc::Config::parseConfigFile()
{
  // parse the config files
  boost::property_tree::ptree pt;
  try {
    boost::property_tree::ini_parser::read_ini(configFile, pt);
    enclavePath = pt.get<string>("enclave_path");
    tcContractEthereumAddr = pt.get<string>("tc_address");
    relayRPCAccessPoint = pt.get<int>("RPC.port");
    sealedECDSAKey = pt.get<string>("sealed.sig_key");
    sealedHybridEncryptionkey = pt.get<string>("sealed.hybrid_key");
  } catch (const exception &e) {
    cout << e.what() << endl;
    cout << "please provide with a correct config file" << endl;
    exit(-1);
  }
}

tc::Config::Config(int argc, const char **argv)
{
  try {
    po::options_description desc("Allowed options");
    desc.add_options()("help,h", "print this message");
    desc.add_options()("measurement,m",
                       po::bool_switch(&isPrintMR)->default_value(false),
                       "print the measurement (MR_ENCLAVE) and exit.");
    desc.add_options()("config,c",
                       po::value(&configFile)->default_value(DFT_CONFIG_FILE),
                       "Path to a config file");
    po::store(po::parse_command_line(argc, argv, desc), vm);

    if (vm.count("help")) {
      cerr << desc;
      cerr.flush();
      exit(0);
    }
    po::notify(vm);
  } catch (po::required_option &e) {
    cerr << e.what() << endl;
    exit(-1);
  } catch (exception &e) {
    cerr << e.what() << endl;
    exit(-1);
  } catch (...) {
    cerr << "Unknown error!" << endl;
    exit(-1);
  }

  parseConfigFile();
}

string tc::Config::toString()
{
  stringstream ss;
  ss << "Using config file: " << this->getConfigFile() << endl;
  ss << "+ using enclave image: " << this->getEnclavePath() << endl;
  ss << "+ listening for TC relay at port: " << this->getRelayRPCAccessPoint()
     << endl;
  ss << "+ serving contract at: " << this->getTcEthereumAddress();
  return ss.str();
}

const string &tc::Config::getConfigFile() const { return configFile; }
int tc::Config::getRelayRPCAccessPoint() const { return relayRPCAccessPoint; }
const string &tc::Config::getSealedSigKey() const { return sealedECDSAKey; }
const string &tc::Config::getSealedHybridKey() const
{
  return sealedHybridEncryptionkey;
}
const string &tc::Config::getEnclavePath() const { return enclavePath; }
const string &tc::Config::getTcEthereumAddress() const
{
  return tcContractEthereumAddr;
}
bool tc::Config::getIsPrintMR() const { return isPrintMR; }


text:
#include "../DynAutoDiff/Distributions.hpp"
#include "../DynAutoDiff/Var.hpp"
#include <algorithm>
#include <boost/test/tools/old/interface.hpp>
#include <eigen3/Eigen/Core>
#include <iostream>
#include <ostream>
#include <vector>

#define BOOST_TEST_MODULE Normal_Test
#include <boost/test/included/unit_test.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#define TL 1e-10

using namespace Eigen;
using namespace std;
using namespace DynAutoDiff;

BOOST_AUTO_TEST_SUITE(Initialize_Variable_Test)

BOOST_AUTO_TEST_CASE(init_var_test) {
    auto X = load("X.txt");

    BOOST_CHECK_EQUAL(X->rows(), 1000);
    BOOST_CHECK_EQUAL(X->cols(), 5);
    BOOST_CHECK_CLOSE(X->v(0, 0), -0.343003152130103, TL);
    BOOST_CHECK_CLOSE(X->v(5, 4), -0.0470153684815493, TL);
    BOOST_CHECK_CLOSE(X->v(99, 4), 0.303972116239077, TL);

    auto y = load("y.txt");

    BOOST_CHECK_EQUAL(y->rows(), 1000);
    BOOST_CHECK_EQUAL(y->cols(), 1);
    BOOST_CHECK_CLOSE(y->v(99, 0), -1.70565299307618, TL);
}
BOOST_AUTO_TEST_CASE(ivecl_test) {}
BOOST_AUTO_TEST_CASE(times_test) {}

BOOST_AUTO_TEST_CASE(division_test) {}
BOOST_AUTO_TEST_SUITE_END()

max_stars_repo_name: kilasuelika/DynAutoDiff

max_issues_repo_name: kilasuelika/DynAutoDiff

max_forks_repo_name: kilasuelika/DynAutoDiff


text:
//==============================================================================
//         Copyright 2003 - 2011   LASMEA UMR 6602 CNRS/Univ. Clermont II
//         Copyright 2009 - 2011   LRI    UMR 8623 CNRS/Univ Paris Sud XI
//
//          Distributed under the Boost Software License, Version 1.0.
//                 See accompanying file LICENSE.txt or copy at
//                     http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef NT2_CORE_FUNCTIONS_SIMD_INNER_FOLD_HPP_INCLUDED
#define NT2_CORE_FUNCTIONS_SIMD_INNER_FOLD_HPP_INCLUDED

#include <nt2/core/functions/inner_fold.hpp>
#include <nt2/core/functions/details/fold_step.hpp>
#include <boost/simd/sdk/simd/native.hpp>
#include <boost/simd/sdk/simd/meta/is_vectorizable.hpp>

#ifndef BOOST_SIMD_NO_SIMD

namespace nt2 { namespace ext
{
  //============================================================================
  // General inner_fold
  //============================================================================
  BOOST_DISPATCH_IMPLEMENT_IF   ( inner_fold_, boost::simd::tag::simd_
                                , (Out)(In)(Neutral)(Bop)(Uop)
                                , ( boost::simd::meta::
                                    is_vectorizable < typename Out::value_type
                                                    , BOOST_SIMD_DEFAULT_EXTENSION
                                                    >
                                  )
                                , ((ast_< Out, nt2::container::domain>))
                                  ((ast_< In, nt2::container::domain>))
                                  (unspecified_<Neutral>)
                                  (unspecified_<Bop>)
                                  (unspecified_<Uop>)
                                )
  {
    typedef void                                                              result_type;
    typedef typename Out::value_type                                           value_type;
    typedef typename In::extent_type                                          extent_type;
    typedef boost::simd::native<value_type,BOOST_SIMD_DEFAULT_EXTENSION>      target_type;

    BOOST_FORCEINLINE result_type
    operator()(Out& out, In& in
              , Neutral const& neutral, Bop const& bop, Uop const& uop
              ) const
    {
      extent_type ext = in.extent();
      std::size_t obound = nt2::numel(boost::fusion::pop_front(ext));
      static const std::size_t N = boost::simd::meta::cardinal_of<target_type>::value;
      std::size_t bound  = boost::fusion::at_c<0>(ext);
      std::size_t nb_vec = (bound/N);
      std::size_t ibound = nb_vec * N;

      for(std::size_t j = 0, k = 0; j != obound; ++j, k+=bound)
      {
        target_type vec_out = details::fold_step(
          neutral(nt2::meta::as_<target_type>()), in, bop, k, nb_vec, N
        );

        value_type s_out = uop( vec_out );
        s_out = details::fold_step(s_out, in, bop, k+ibound, bound-ibound, 1);

        nt2::run(out, j, s_out);
      }
    }
  };
} }

#endif
#endif

ext: hpp


text:
// This file is auto-generated, don't edit it. Thanks.

#ifndef ALIBABACLOUD_THREEDVISION20210131_H_
#define ALIBABACLOUD_THREEDVISION20210131_H_

#include <alibabacloud/open_api.hpp>
#include <boost/throw_exception.hpp>
#include <darabonba/core.hpp>
#include <darabonba/util.hpp>
#include <iostream>
#include <map>

using namespace std;

namespace Alibabacloud_Threedvision20210131 {
class ReconstructBodyBySingleImageRequest : public Darabonba::Model {
public:
  shared_ptr<string> imageURL{};

  ReconstructBodyBySingleImageRequest() {}

  explicit ReconstructBodyBySingleImageRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (imageURL) {
      res["ImageURL"] = boost::any(*imageURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ImageURL") != m.end() && !m["ImageURL"].empty()) {
      imageURL = make_shared<string>(boost::any_cast<string>(m["ImageURL"]));
    }
  }

  virtual ~ReconstructBodyBySingleImageRequest() = default;
};
class ReconstructBodyBySingleImageAdvanceRequest : public Darabonba::Model {
public:
  shared_ptr<Darabonba::Stream> imageURLObject{};

  ReconstructBodyBySingleImageAdvanceRequest() {}

  explicit ReconstructBodyBySingleImageAdvanceRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!imageURLObject) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("imageURLObject is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (imageURLObject) {
      res["ImageURLObject"] = boost::any(*imageURLObject);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ImageURLObject") != m.end() && !m["ImageURLObject"].empty()) {
      imageURLObject = make_shared<Darabonba::Stream>(boost::any_cast<Darabonba::Stream>(m["ImageURLObject"]));
    }
  }

  virtual ~ReconstructBodyBySingleImageAdvanceRequest() = default;
};
class ReconstructBodyBySingleImageResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> depthURL{};
  shared_ptr<string> meshURL{};

  ReconstructBodyBySingleImageResponseBodyData() {}

  explicit ReconstructBodyBySingleImageResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (depthURL) {
      res["DepthURL"] = boost::any(*depthURL);
    }
    if (meshURL) {
      res["MeshURL"] = boost::any(*meshURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("DepthURL") != m.end() && !m["DepthURL"].empty()) {
      depthURL = make_shared<string>(boost::any_cast<string>(m["DepthURL"]));
    }
    if (m.find("MeshURL") != m.end() && !m["MeshURL"].empty()) {
      meshURL = make_shared<string>(boost::any_cast<string>(m["MeshURL"]));
    }
  }

  virtual ~ReconstructBodyBySingleImageResponseBodyData() = default;
};
class ReconstructBodyBySingleImageResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<ReconstructBodyBySingleImageResponseBodyData> data{};

  ReconstructBodyBySingleImageResponseBody() {}

  explicit ReconstructBodyBySingleImageResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        ReconstructBodyBySingleImageResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<ReconstructBodyBySingleImageResponseBodyData>(model1);
      }
    }
  }

  virtual ~ReconstructBodyBySingleImageResponseBody() = default;
};
class ReconstructBodyBySingleImageResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<ReconstructBodyBySingleImageResponseBody> body{};

  ReconstructBodyBySingleImageResponse() {}

  explicit ReconstructBodyBySingleImageResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        ReconstructBodyBySingleImageResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<ReconstructBodyBySingleImageResponseBody>(model1);
      }
    }
  }

  virtual ~ReconstructBodyBySingleImageResponse() = default;
};
class ReconstructThreeDMultiViewRequest : public Darabonba::Model {
public:
  shared_ptr<string> zipFileUrl{};
  shared_ptr<string> mode{};

  ReconstructThreeDMultiViewRequest() {}

  explicit ReconstructThreeDMultiViewRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (zipFileUrl) {
      res["ZipFileUrl"] = boost::any(*zipFileUrl);
    }
    if (mode) {
      res["Mode"] = boost::any(*mode);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ZipFileUrl") != m.end() && !m["ZipFileUrl"].empty()) {
      zipFileUrl = make_shared<string>(boost::any_cast<string>(m["ZipFileUrl"]));
    }
    if (m.find("Mode") != m.end() && !m["Mode"].empty()) {
      mode = make_shared<string>(boost::any_cast<string>(m["Mode"]));
    }
  }

  virtual ~ReconstructThreeDMultiViewRequest() = default;
};
class ReconstructThreeDMultiViewAdvanceRequest : public Darabonba::Model {
public:
  shared_ptr<Darabonba::Stream> zipFileUrlObject{};
  shared_ptr<string> mode{};

  ReconstructThreeDMultiViewAdvanceRequest() {}

  explicit ReconstructThreeDMultiViewAdvanceRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!zipFileUrlObject) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("zipFileUrlObject is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (zipFileUrlObject) {
      res["ZipFileUrlObject"] = boost::any(*zipFileUrlObject);
    }
    if (mode) {
      res["Mode"] = boost::any(*mode);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ZipFileUrlObject") != m.end() && !m["ZipFileUrlObject"].empty()) {
      zipFileUrlObject = make_shared<Darabonba::Stream>(boost::any_cast<Darabonba::Stream>(m["ZipFileUrlObject"]));
    }
    if (m.find("Mode") != m.end() && !m["Mode"].empty()) {
      mode = make_shared<string>(boost::any_cast<string>(m["Mode"]));
    }
  }

  virtual ~ReconstructThreeDMultiViewAdvanceRequest() = default;
};
class ReconstructThreeDMultiViewResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> pointCloudURL{};

  ReconstructThreeDMultiViewResponseBodyData() {}

  explicit ReconstructThreeDMultiViewResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (pointCloudURL) {
      res["PointCloudURL"] = boost::any(*pointCloudURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("PointCloudURL") != m.end() && !m["PointCloudURL"].empty()) {
      pointCloudURL = make_shared<string>(boost::any_cast<string>(m["PointCloudURL"]));
    }
  }

  virtual ~ReconstructThreeDMultiViewResponseBodyData() = default;
};
class ReconstructThreeDMultiViewResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<ReconstructThreeDMultiViewResponseBodyData> data{};

  ReconstructThreeDMultiViewResponseBody() {}

  explicit ReconstructThreeDMultiViewResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        ReconstructThreeDMultiViewResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<ReconstructThreeDMultiViewResponseBodyData>(model1);
      }
    }
  }

  virtual ~ReconstructThreeDMultiViewResponseBody() = default;
};
class ReconstructThreeDMultiViewResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<ReconstructThreeDMultiViewResponseBody> body{};

  ReconstructThreeDMultiViewResponse() {}

  explicit ReconstructThreeDMultiViewResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        ReconstructThreeDMultiViewResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<ReconstructThreeDMultiViewResponseBody>(model1);
      }
    }
  }

  virtual ~ReconstructThreeDMultiViewResponse() = default;
};
class GetAsyncJobResultRequest : public Darabonba::Model {
public:
  shared_ptr<string> jobId{};

  GetAsyncJobResultRequest() {}

  explicit GetAsyncJobResultRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (jobId) {
      res["JobId"] = boost::any(*jobId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("JobId") != m.end() && !m["JobId"].empty()) {
      jobId = make_shared<string>(boost::any_cast<string>(m["JobId"]));
    }
  }

  virtual ~GetAsyncJobResultRequest() = default;
};
class GetAsyncJobResultResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> status{};
  shared_ptr<string> errorMessage{};
  shared_ptr<string> result{};
  shared_ptr<string> errorCode{};
  shared_ptr<string> jobId{};

  GetAsyncJobResultResponseBodyData() {}

  explicit GetAsyncJobResultResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (status) {
      res["Status"] = boost::any(*status);
    }
    if (errorMessage) {
      res["ErrorMessage"] = boost::any(*errorMessage);
    }
    if (result) {
      res["Result"] = boost::any(*result);
    }
    if (errorCode) {
      res["ErrorCode"] = boost::any(*errorCode);
    }
    if (jobId) {
      res["JobId"] = boost::any(*jobId);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("Status") != m.end() && !m["Status"].empty()) {
      status = make_shared<string>(boost::any_cast<string>(m["Status"]));
    }
    if (m.find("ErrorMessage") != m.end() && !m["ErrorMessage"].empty()) {
      errorMessage = make_shared<string>(boost::any_cast<string>(m["ErrorMessage"]));
    }
    if (m.find("Result") != m.end() && !m["Result"].empty()) {
      result = make_shared<string>(boost::any_cast<string>(m["Result"]));
    }
    if (m.find("ErrorCode") != m.end() && !m["ErrorCode"].empty()) {
      errorCode = make_shared<string>(boost::any_cast<string>(m["ErrorCode"]));
    }
    if (m.find("JobId") != m.end() && !m["JobId"].empty()) {
      jobId = make_shared<string>(boost::any_cast<string>(m["JobId"]));
    }
  }

  virtual ~GetAsyncJobResultResponseBodyData() = default;
};
class GetAsyncJobResultResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<GetAsyncJobResultResponseBodyData> data{};

  GetAsyncJobResultResponseBody() {}

  explicit GetAsyncJobResultResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        GetAsyncJobResultResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<GetAsyncJobResultResponseBodyData>(model1);
      }
    }
  }

  virtual ~GetAsyncJobResultResponseBody() = default;
};
class GetAsyncJobResultResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<GetAsyncJobResultResponseBody> body{};

  GetAsyncJobResultResponse() {}

  explicit GetAsyncJobResultResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        GetAsyncJobResultResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<GetAsyncJobResultResponseBody>(model1);
      }
    }
  }

  virtual ~GetAsyncJobResultResponse() = default;
};
class EstimateStereoImageDepthRequest : public Darabonba::Model {
public:
  shared_ptr<string> leftImageURL{};
  shared_ptr<string> rightImageURL{};

  EstimateStereoImageDepthRequest() {}

  explicit EstimateStereoImageDepthRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (leftImageURL) {
      res["LeftImageURL"] = boost::any(*leftImageURL);
    }
    if (rightImageURL) {
      res["RightImageURL"] = boost::any(*rightImageURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("LeftImageURL") != m.end() && !m["LeftImageURL"].empty()) {
      leftImageURL = make_shared<string>(boost::any_cast<string>(m["LeftImageURL"]));
    }
    if (m.find("RightImageURL") != m.end() && !m["RightImageURL"].empty()) {
      rightImageURL = make_shared<string>(boost::any_cast<string>(m["RightImageURL"]));
    }
  }

  virtual ~EstimateStereoImageDepthRequest() = default;
};
class EstimateStereoImageDepthResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> disparityMapURL{};
  shared_ptr<string> disparityVisURL{};

  EstimateStereoImageDepthResponseBodyData() {}

  explicit EstimateStereoImageDepthResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (disparityMapURL) {
      res["DisparityMapURL"] = boost::any(*disparityMapURL);
    }
    if (disparityVisURL) {
      res["DisparityVisURL"] = boost::any(*disparityVisURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("DisparityMapURL") != m.end() && !m["DisparityMapURL"].empty()) {
      disparityMapURL = make_shared<string>(boost::any_cast<string>(m["DisparityMapURL"]));
    }
    if (m.find("DisparityVisURL") != m.end() && !m["DisparityVisURL"].empty()) {
      disparityVisURL = make_shared<string>(boost::any_cast<string>(m["DisparityVisURL"]));
    }
  }

  virtual ~EstimateStereoImageDepthResponseBodyData() = default;
};
class EstimateStereoImageDepthResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<EstimateStereoImageDepthResponseBodyData> data{};

  EstimateStereoImageDepthResponseBody() {}

  explicit EstimateStereoImageDepthResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        EstimateStereoImageDepthResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<EstimateStereoImageDepthResponseBodyData>(model1);
      }
    }
  }

  virtual ~EstimateStereoImageDepthResponseBody() = default;
};
class EstimateStereoImageDepthResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<EstimateStereoImageDepthResponseBody> body{};

  EstimateStereoImageDepthResponse() {}

  explicit EstimateStereoImageDepthResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        EstimateStereoImageDepthResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<EstimateStereoImageDepthResponseBody>(model1);
      }
    }
  }

  virtual ~EstimateStereoImageDepthResponse() = default;
};
class EstimateMonocularImageDepthRequest : public Darabonba::Model {
public:
  shared_ptr<string> imageURL{};

  EstimateMonocularImageDepthRequest() {}

  explicit EstimateMonocularImageDepthRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (imageURL) {
      res["ImageURL"] = boost::any(*imageURL);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ImageURL") != m.end() && !m["ImageURL"].empty()) {
      imageURL = make_shared<string>(boost::any_cast<string>(m["ImageURL"]));
    }
  }

  virtual ~EstimateMonocularImageDepthRequest() = default;
};
class EstimateMonocularImageDepthAdvanceRequest : public Darabonba::Model {
public:
  shared_ptr<Darabonba::Stream> imageURLObject{};

  EstimateMonocularImageDepthAdvanceRequest() {}

  explicit EstimateMonocularImageDepthAdvanceRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!imageURLObject) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("imageURLObject is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (imageURLObject) {
      res["ImageURLObject"] = boost::any(*imageURLObject);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("ImageURLObject") != m.end() && !m["ImageURLObject"].empty()) {
      imageURLObject = make_shared<Darabonba::Stream>(boost::any_cast<Darabonba::Stream>(m["ImageURLObject"]));
    }
  }

  virtual ~EstimateMonocularImageDepthAdvanceRequest() = default;
};
class EstimateMonocularImageDepthResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> depthMapUrl{};
  shared_ptr<string> depthToColorUrl{};

  EstimateMonocularImageDepthResponseBodyData() {}

  explicit EstimateMonocularImageDepthResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (depthMapUrl) {
      res["DepthMapUrl"] = boost::any(*depthMapUrl);
    }
    if (depthToColorUrl) {
      res["DepthToColorUrl"] = boost::any(*depthToColorUrl);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("DepthMapUrl") != m.end() && !m["DepthMapUrl"].empty()) {
      depthMapUrl = make_shared<string>(boost::any_cast<string>(m["DepthMapUrl"]));
    }
    if (m.find("DepthToColorUrl") != m.end() && !m["DepthToColorUrl"].empty()) {
      depthToColorUrl = make_shared<string>(boost::any_cast<string>(m["DepthToColorUrl"]));
    }
  }

  virtual ~EstimateMonocularImageDepthResponseBodyData() = default;
};
class EstimateMonocularImageDepthResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<EstimateMonocularImageDepthResponseBodyData> data{};

  EstimateMonocularImageDepthResponseBody() {}

  explicit EstimateMonocularImageDepthResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        EstimateMonocularImageDepthResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<EstimateMonocularImageDepthResponseBodyData>(model1);
      }
    }
  }

  virtual ~EstimateMonocularImageDepthResponseBody() = default;
};
class EstimateMonocularImageDepthResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<EstimateMonocularImageDepthResponseBody> body{};

  EstimateMonocularImageDepthResponse() {}

  explicit EstimateMonocularImageDepthResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        EstimateMonocularImageDepthResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<EstimateMonocularImageDepthResponseBody>(model1);
      }
    }
  }

  virtual ~EstimateMonocularImageDepthResponse() = default;
};
class EstimateMonocularVideoDepthRequest : public Darabonba::Model {
public:
  shared_ptr<string> videoURL{};
  shared_ptr<string> sampleRate{};

  EstimateMonocularVideoDepthRequest() {}

  explicit EstimateMonocularVideoDepthRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (videoURL) {
      res["VideoURL"] = boost::any(*videoURL);
    }
    if (sampleRate) {
      res["SampleRate"] = boost::any(*sampleRate);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("VideoURL") != m.end() && !m["VideoURL"].empty()) {
      videoURL = make_shared<string>(boost::any_cast<string>(m["VideoURL"]));
    }
    if (m.find("SampleRate") != m.end() && !m["SampleRate"].empty()) {
      sampleRate = make_shared<string>(boost::any_cast<string>(m["SampleRate"]));
    }
  }

  virtual ~EstimateMonocularVideoDepthRequest() = default;
};
class EstimateMonocularVideoDepthAdvanceRequest : public Darabonba::Model {
public:
  shared_ptr<Darabonba::Stream> videoURLObject{};
  shared_ptr<string> sampleRate{};

  EstimateMonocularVideoDepthAdvanceRequest() {}

  explicit EstimateMonocularVideoDepthAdvanceRequest(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!videoURLObject) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("videoURLObject is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (videoURLObject) {
      res["VideoURLObject"] = boost::any(*videoURLObject);
    }
    if (sampleRate) {
      res["SampleRate"] = boost::any(*sampleRate);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("VideoURLObject") != m.end() && !m["VideoURLObject"].empty()) {
      videoURLObject = make_shared<Darabonba::Stream>(boost::any_cast<Darabonba::Stream>(m["VideoURLObject"]));
    }
    if (m.find("SampleRate") != m.end() && !m["SampleRate"].empty()) {
      sampleRate = make_shared<string>(boost::any_cast<string>(m["SampleRate"]));
    }
  }

  virtual ~EstimateMonocularVideoDepthAdvanceRequest() = default;
};
class EstimateMonocularVideoDepthResponseBodyData : public Darabonba::Model {
public:
  shared_ptr<string> depthUrl{};
  shared_ptr<string> depthVisUrl{};

  EstimateMonocularVideoDepthResponseBodyData() {}

  explicit EstimateMonocularVideoDepthResponseBodyData(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (depthUrl) {
      res["DepthUrl"] = boost::any(*depthUrl);
    }
    if (depthVisUrl) {
      res["DepthVisUrl"] = boost::any(*depthVisUrl);
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("DepthUrl") != m.end() && !m["DepthUrl"].empty()) {
      depthUrl = make_shared<string>(boost::any_cast<string>(m["DepthUrl"]));
    }
    if (m.find("DepthVisUrl") != m.end() && !m["DepthVisUrl"].empty()) {
      depthVisUrl = make_shared<string>(boost::any_cast<string>(m["DepthVisUrl"]));
    }
  }

  virtual ~EstimateMonocularVideoDepthResponseBodyData() = default;
};
class EstimateMonocularVideoDepthResponseBody : public Darabonba::Model {
public:
  shared_ptr<string> requestId{};
  shared_ptr<EstimateMonocularVideoDepthResponseBodyData> data{};

  EstimateMonocularVideoDepthResponseBody() {}

  explicit EstimateMonocularVideoDepthResponseBody(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {}

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (requestId) {
      res["RequestId"] = boost::any(*requestId);
    }
    if (data) {
      res["Data"] = data ? boost::any(data->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("RequestId") != m.end() && !m["RequestId"].empty()) {
      requestId = make_shared<string>(boost::any_cast<string>(m["RequestId"]));
    }
    if (m.find("Data") != m.end() && !m["Data"].empty()) {
      if (typeid(map<string, boost::any>) == m["Data"].type()) {
        EstimateMonocularVideoDepthResponseBodyData model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["Data"]));
        data = make_shared<EstimateMonocularVideoDepthResponseBodyData>(model1);
      }
    }
  }

  virtual ~EstimateMonocularVideoDepthResponseBody() = default;
};
class EstimateMonocularVideoDepthResponse : public Darabonba::Model {
public:
  shared_ptr<map<string, string>> headers{};
  shared_ptr<EstimateMonocularVideoDepthResponseBody> body{};

  EstimateMonocularVideoDepthResponse() {}

  explicit EstimateMonocularVideoDepthResponse(const std::map<string, boost::any> &config) : Darabonba::Model(config) {
    fromMap(config);
  };

  void validate() override {
    if (!headers) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("headers is required.")));
    }
    if (!body) {
      BOOST_THROW_EXCEPTION(boost::enable_error_info(std::runtime_error("body is required.")));
    }
  }

  map<string, boost::any> toMap() override {
    map<string, boost::any> res;
    if (headers) {
      res["headers"] = boost::any(*headers);
    }
    if (body) {
      res["body"] = body ? boost::any(body->toMap()) : boost::any(map<string,boost::any>({}));
    }
    return res;
  }

  void fromMap(map<string, boost::any> m) override {
    if (m.find("headers") != m.end() && !m["headers"].empty()) {
      map<string, string> map1 = boost::any_cast<map<string, string>>(m["headers"]);
      map<string, string> toMap1;
      for (auto item:map1) {
         toMap1[item.first] = item.second;
      }
      headers = make_shared<map<string, string>>(toMap1);
    }
    if (m.find("body") != m.end() && !m["body"].empty()) {
      if (typeid(map<string, boost::any>) == m["body"].type()) {
        EstimateMonocularVideoDepthResponseBody model1;
        model1.fromMap(boost::any_cast<map<string, boost::any>>(m["body"]));
        body = make_shared<EstimateMonocularVideoDepthResponseBody>(model1);
      }
    }
  }

  virtual ~EstimateMonocularVideoDepthResponse() = default;
};
class Client : Alibabacloud_OpenApi::Client {
public:
  explicit Client(const shared_ptr<Alibabacloud_OpenApi::Config>& config);
  string getEndpoint(shared_ptr<string> productId,
                     shared_ptr<string> regionId,
                     shared_ptr<string> endpointRule,
                     shared_ptr<string> network,
                     shared_ptr<string> suffix,
                     shared_ptr<map<string, string>> endpointMap,
                     shared_ptr<string> endpoint);
  ReconstructBodyBySingleImageResponse reconstructBodyBySingleImageWithOptions(shared_ptr<ReconstructBodyBySingleImageRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  ReconstructBodyBySingleImageResponse reconstructBodyBySingleImage(shared_ptr<ReconstructBodyBySingleImageRequest> request);
  ReconstructBodyBySingleImageResponse reconstructBodyBySingleImageAdvance(shared_ptr<ReconstructBodyBySingleImageAdvanceRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  ReconstructThreeDMultiViewResponse reconstructThreeDMultiViewWithOptions(shared_ptr<ReconstructThreeDMultiViewRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  ReconstructThreeDMultiViewResponse reconstructThreeDMultiView(shared_ptr<ReconstructThreeDMultiViewRequest> request);
  ReconstructThreeDMultiViewResponse reconstructThreeDMultiViewAdvance(shared_ptr<ReconstructThreeDMultiViewAdvanceRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  GetAsyncJobResultResponse getAsyncJobResultWithOptions(shared_ptr<GetAsyncJobResultRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  GetAsyncJobResultResponse getAsyncJobResult(shared_ptr<GetAsyncJobResultRequest> request);
  EstimateStereoImageDepthResponse estimateStereoImageDepthWithOptions(shared_ptr<EstimateStereoImageDepthRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  EstimateStereoImageDepthResponse estimateStereoImageDepth(shared_ptr<EstimateStereoImageDepthRequest> request);
  EstimateMonocularImageDepthResponse estimateMonocularImageDepthWithOptions(shared_ptr<EstimateMonocularImageDepthRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  EstimateMonocularImageDepthResponse estimateMonocularImageDepth(shared_ptr<EstimateMonocularImageDepthRequest> request);
  EstimateMonocularImageDepthResponse estimateMonocularImageDepthAdvance(shared_ptr<EstimateMonocularImageDepthAdvanceRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  EstimateMonocularVideoDepthResponse estimateMonocularVideoDepthWithOptions(shared_ptr<EstimateMonocularVideoDepthRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);
  EstimateMonocularVideoDepthResponse estimateMonocularVideoDepth(shared_ptr<EstimateMonocularVideoDepthRequest> request);
  EstimateMonocularVideoDepthResponse estimateMonocularVideoDepthAdvance(shared_ptr<EstimateMonocularVideoDepthAdvanceRequest> request, shared_ptr<Darabonba_Util::RuntimeOptions> runtime);

  virtual ~Client() = default;
};
} // namespace Alibabacloud_Threedvision20210131

#endif

max_stars_repo_name: aliyun/alibabacloud-cpp-sdk

max_issues_repo_name: aliyun/alibabacloud-cpp-sdk

max_forks_repo_name: aliyun/alibabacloud-cpp-sdk


text:
//---------------------------------------------------------------------------//
// Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
//
// 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
//
// See http://kylelutz.github.com/compute for more information.
//---------------------------------------------------------------------------//

#define BOOST_TEST_MODULE TestSetDifference
#include <boost/test/unit_test.hpp>

#include <boost/compute/command_queue.hpp>
#include <boost/compute/algorithm/set_difference.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/types/builtin.hpp>

#include "check_macros.hpp"
#include "context_setup.hpp"

namespace bc = boost::compute;

BOOST_AUTO_TEST_CASE(set_difference_int)
{
    int dataset1[] = {1, 1, 2, 2, 2, 2, 3, 3, 4, 5, 6, 10};
    bc::vector<bc::int_> set1(dataset1, dataset1 + 12, queue);

    int dataset2[] = {0, 2, 2, 4, 5, 6, 8, 8, 9, 9, 9, 13};
    bc::vector<bc::int_> set2(dataset2, dataset2 + 12, queue);

    bc::vector<bc::uint_>result(7, queue.get_context());

    bc::vector<bc::uint_>::iterator iter =
        bc::set_difference(set1.begin(), set1.begin() + 12,
                             set2.begin(), set2.begin() + 12,
                             result.begin(), queue);

    CHECK_RANGE_EQUAL(int, 7, result, (1, 1, 2, 2, 3, 3, 10));
    BOOST_VERIFY(iter == result.begin()+7);
}

BOOST_AUTO_TEST_CASE(set_difference_string)
{
    char string1[] = "abcccdddeeff";
    bc::vector<bc::char_> set1(string1, string1 + 12, queue);

    char string2[] = "bccdfgh";
    bc::vector<bc::char_> set2(string2, string2 + 7, queue);

    bc::vector<bc::char_>result(7, queue.get_context());

    bc::vector<bc::char_>::iterator iter =
        bc::set_difference(set1.begin(), set1.begin() + 12,
                             set2.begin(), set2.begin() + 7,
                             result.begin(), queue);

    CHECK_RANGE_EQUAL(char, 7, result, ('a', 'c', 'd', 'd', 'e', 'e', 'f'));
    BOOST_VERIFY(iter == result.begin()+7);
}

BOOST_AUTO_TEST_SUITE_END()

max_stars_repo_name: bastiankoe/compute

max_issues_repo_name: bastiankoe/compute

max_forks_repo_name: bastiankoe/compute


text:
#ifndef SHIFT_NETWORK_UDPSOCKETIMPL_HPP
#define SHIFT_NETWORK_UDPSOCKETIMPL_HPP

#include <queue>
#include <atomic>
#include <shift/core/boost_disable_warnings.hpp>
#include <boost/asio/spawn.hpp>
#include <shift/core/boost_restore_warnings.hpp>
#include "shift/network/udp_socket.hpp"

namespace shift::network
{
/// A Udp socket.
class udp_socket::impl
{
public:
  using PacketSize = std::uint16_t;

  /// Constructor.
  impl();

  /// Destructor.
  virtual ~impl();

  /// Implementation of udp_socket::open.
  bool open(udp_socket& socket, boost::asio::ip::address bind_address,
            std::uint16_t bind_port,
            boost::asio::ip::address multicast_address);

  /// Implementation of udp_socket::close.
  void close(udp_socket& socket);

  /// The actual implementation of udp_socket::post encapsulated using the
  /// read_write_strand thread synchronization object.
  void post(std::shared_ptr<udp_socket> socket, std::vector<char> buffer,
            boost::asio::ip::udp::endpoint destination);

  /// The coroutine method responsible to reading incomming data until the
  /// socket gets closed or until an error occurs.
  void read_routine(std::shared_ptr<udp_socket> socket,
                    boost::asio::yield_context yield);

  /// The coroutine method responsible to writing all queued outgoing data
  /// until the work is done, the socket gets closed or until an error
  /// occurs.
  void write_routine(std::shared_ptr<udp_socket> socket,
                     boost::asio::yield_context yield);

  network_host& host;
  boost::asio::ip::udp::socket underlying_socket;
  boost::asio::ip::udp::endpoint local_endpoint =
    boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0);

  boost::asio::io_context::strand read_write_strand;
  std::queue<std::pair<boost::asio::ip::udp::endpoint, std::vector<char>>>
    outgoing_buffer_queue;
  bool parallel_write_pending = false;
  std::atomic_flag closing = ATOMIC_FLAG_INIT;
};
}

#endif

max_stars_repo_name: cspanier/shift

max_issues_repo_name: cspanier/shift

max_forks_repo_name: cspanier/shift


text:
/**
 * @file ProgramOptions.hpp
 * @brief Declaration of ProgramOptions functions.
 * @author Ankit Srivastava <asrivast@gatech.edu>
 *
 * Copyright 2018 Georgia Institute of Technology
 *
 * 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 PROGRAMOPTIONS_HPP_
#define PROGRAMOPTIONS_HPP_

#include <string>

#include <boost/program_options.hpp>

namespace po = boost::program_options;

/**
 * Utility class for parsing command line arguments.
 */
class ProgramOptions {
public:
  ProgramOptions();

  void
  parse(int, char**);

  std::string
  deviceName() const;

  std::string
  macrosDir() const;

  std::string
  fsmName() const;

  std::string
  intervalsFile() const;

  std::string
  pointsFile() const;

  size_t
  numBytes() const;

  size_t
  randomSeed() const;

  size_t
  numIntervals() const;

  size_t
  numPoints() const;

  size_t
  maxChunkSize() const;

  bool
  isReal() const;

  bool
  isSigned() const;

  ~ProgramOptions();

private:
  po::options_description m_options;
  std::string m_deviceName;
  std::string m_macrosDir;
  std::string m_fsmName;
  std::string m_intervalsFile;
  std::string m_pointsFile;
  size_t m_numBytes;
  size_t m_randomSeed;
  size_t m_numIntervals;
  size_t m_numPoints;
  size_t m_maxChunkSize;
  bool m_isReal;
  bool m_isSigned;
}; // class ProgramOptions

#endif // PROGRAMOPTIONS_HPP_


text:
//===============================
// AUTHOR     : Naif Tarafdar
// CREATE DATE     : April 20, 2019
//===============================

#ifndef __GALAPAGOS_NET_TCP_HPP__   // if x.h hasn't been included yet...
#define __GALAPAGOS_NET_TCP_HPP__

#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <cstdlib>
#include <iostream>
#include <thread>
#include <memory>
#include <utility>
#include <boost/asio.hpp>

#include "common.hpp"
#include "galapagos_interface.hpp"
#include "galapagos_n_to_one_router.hpp"
#include "galapagos_net_tcp_session.hpp"
#include "galapagos_net_tcp_accept_server.hpp"
#include "galapagos_net_tcp_server_send.hpp"

#include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/fmt/bin_to_hex.h"

#include "galapagos_external_driver.hpp"

namespace galapagos{
    namespace net{
/** @brief Class tcp driver

    A software implementation of an n to one router, used by network node to arbitrade output of sessions into the node.
    Routes between input interfaces(s_axis) and an output interface(m_axis).
    @author Naif Tarafdar
    @date April 20, 2019
    */
        template<class T>
        class tcp: public galapagos::external_driver<T>{
            public:
                tcp(
                    short port,
                    std::vector <std::string> kern_info_table,
                    std::string  my_address,
                    std::shared_ptr <spdlog::logger> _logger
                    );
                ~tcp(){}
		//virtual functions of external_driver
                interface<T> * get_s_axis();
                interface<T> * get_m_axis();
		        void start();
	    	    void init(galapagos::done_clean *, int * _packets_in_flight, std::mutex * _mutex_packets_in_flight);
                std::unique_ptr<std::thread> t;
	        private:
		        interface <T> s_axis;
                boost::asio::io_context io_context;
       		    std::unique_ptr < tcp_session_container<T> > tsc;
                std::unique_ptr < galapagos::done_clean > tsc_dc;
		        std::unique_ptr < tcp_server_send<T> > tss;
                std::unique_ptr < galapagos::done_clean > tss_dc;
		        std::unique_ptr < tcp_accept_server<T> > tas;
		        std::unique_ptr< galapagos::n_to_one_router<T> > router_out;
                std::unique_ptr < galapagos::done_clean > router_out_dc;
                short port;
                std::vector <std::string>  kern_info_table;
                std::string   my_address;
                void wait_for_end();
        };

    }//net namespace
}//galapagos namespace

template<class T>
galapagos::net::tcp<T>::tcp(
            short _port,
            std::vector <std::string>  _kern_info_table,
            std::string   _my_address,
            std::shared_ptr <spdlog::logger> _logger
            )
    	:
	galapagos::external_driver<T>(_logger),
	s_axis(std::string("tcp_s_axis"), _logger)

{

    port = _port;
    for(int i=0; i< _kern_info_table.size(); i++)
        kern_info_table.push_back(_kern_info_table[i]);
    my_address = _my_address;
    this->logger->info("created tcp");
    this->logger->debug("tcp constructor with {0:d}", kern_info_table.size());
    this->logger->flush();
    io_context.run();
}

template<class T>
galapagos::interface<T> * galapagos::net::tcp<T>::get_s_axis()
{
    return &s_axis;
}

template<class T>
galapagos::interface<T> * galapagos::net::tcp<T>::get_m_axis()
{
    return router_out->get_m_axis();
}

template<class T>
void galapagos::net::tcp<T>::wait_for_end()
{

    router_out_dc->wait_for_clean();
    this->logger->info("tcp router out destroyed");
    tss_dc->wait_for_clean();
    this->logger->info("tcp server send destroyed");
    tsc_dc->wait_for_clean();
    this->logger->info("tcp session container destroyed");
    this->logger->flush();
    this->dc->clean();
    this->logger->info("clean tcp");
    this->logger->flush();
}

template<class T>
void galapagos::net::tcp<T>::start()
{
    this->logger->info("tcp started");
    this->logger->flush();
    router_out->start();
    tss->start();
}

template<class T>
void galapagos::net::tcp<T>::init(
                    galapagos::done_clean * _dc,
					int * _packets_in_flight,
					std::mutex * _mutex_packets_in_flight
					)
{
    this->dc = _dc;
    this->packets_in_flight.num = _packets_in_flight;
    this->packets_in_flight.mutex = _mutex_packets_in_flight;

    router_out_dc = std::make_unique< galapagos::done_clean> (this->dc->done_struct.done, this->dc->done_struct.mutex, this->logger);
    router_out = std::make_unique< galapagos::n_to_one_router<T> > (router_out_dc.get(), this->logger);

    tsc_dc = std::make_unique< galapagos::done_clean> (this->dc->done_struct.done, this->dc->done_struct.mutex, this->logger);
    tsc = std::make_unique< galapagos::net::tcp_session_container<T> > (kern_info_table, my_address, tsc_dc.get(), router_out.get(), this->packets_in_flight.mutex, this->packets_in_flight.num, this->logger);

    tss_dc = std::make_unique< galapagos::done_clean> (this->dc->done_struct.done, this->dc->done_struct.mutex, this->logger);
    tss = std::make_unique< galapagos::net::tcp_server_send<T> > (port, &io_context, tsc.get(), tss_dc.get(), &(this->s_axis), this->logger);
    tas = std::make_unique< galapagos::net::tcp_accept_server<T> > (&io_context, my_address, port, tsc.get(), this->logger);

    t=std::make_unique<std::thread>(&galapagos::net::tcp<T>::wait_for_end, this);
    t->detach();
}

#endif

max_stars_repo_name: JKHHai/galapagos

max_issues_repo_name: JKHHai/galapagos

max_forks_repo_name: JKHHai/galapagos


text:
/*

Copyright 2019 Peter Asanov

Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation files( the "Software"),
to deal in the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#include "options.h"
#include "logger.h"

#include <iostream>

#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>

namespace mpegts
{
namespace po = boost::program_options;
namespace log = boost::log;
namespace fs = boost::filesystem;

bool options::parse(int argc, char *argv[])
{
  po::options_description desc("Options");
  bool log_ts_packets;
  bool log_pes_packets;

  using log::trivial::severity_level;

  desc.add_options()("help", "produce help message")(
      "output_dir,o", po::value(&_output_dir), "output directory")("log_level,l",
      po::value<severity_level>(&_log_level)->default_value(severity_level::info),
      "log level [trace, debug, info, warning, error, fatal]")("log_ts_packets",
      po::bool_switch(&log_ts_packets)->default_value(false), "log TS packets")("log_pes_packets",
      po::bool_switch(&log_pes_packets)->default_value(false), "log PES packets");

  auto print_help = [&]() {
    std::cout << "Usage: " << argv[0] << " [options] <input_file_name>"
              << "\n"
              << desc;
  };

  po::variables_map vm;
  auto parsed = po::command_line_parser(argc, argv).options(desc).run();
  po::store(parsed, vm);
  po::notify(vm);
  if (vm.count("help"))
  {
    print_help();
    return false;
  }

  po::options_description hidden_desc("Hidden options");
  hidden_desc.add_options()("input", po::value(&_input_file)->required());

  // Desc for parsing
  po::options_description parsing_desc;
  parsing_desc.add(desc).add(hidden_desc);

  po::positional_options_description pos;
  pos.add("input", -1);

  parsed = po::command_line_parser(argc, argv).options(parsing_desc).positional(pos).run();

  po::store(parsed, vm);
  try
  {
    po::notify(vm);
    logger::log_ts_packets = log_ts_packets;
    logger::log_pes_packets = log_pes_packets;
  }
  catch (const po::error &)
  {
    std::cerr << "Error: input is required"
              << "\n";
    print_help();
    return false;
  }

  if (_output_dir.empty())
  {
    _output_dir = fs::current_path().string();
  }

  return true;
}

const std::string &options::get_input_file_name() const
{
  return _input_file;
}
const std::string &options::get_oputput_directory() const
{
  return _output_dir;
}

boost::log::trivial::severity_level options::get_log_severity_level() const
{
  return _log_level;
}

void options::print() const
{
  BOOST_LOG_TRIVIAL(info) << "Input file name: " << _input_file;
  BOOST_LOG_TRIVIAL(info) << "Output directory: " << _output_dir;
  BOOST_LOG_TRIVIAL(info) << "Log level: " << _log_level;
  BOOST_LOG_TRIVIAL(info) << "Log TS packets: " << logger::log_ts_packets;
  BOOST_LOG_TRIVIAL(info) << "Log PES packets: " << logger::log_pes_packets;
}

} // namespace mpegts

max_stars_repo_name: leaxdc/mpeg-ts-split

max_issues_repo_name: leaxdc/mpeg-ts-split

max_forks_repo_name: leaxdc/mpeg-ts-split


text:
/*=============================================================================
  Copyright (c) 2010-2016 Bolero MURAKAMI
  https://github.com/bolero-MURAKAMI/Sprig

  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 SPRIG_CONFIG_LIB_YAMLCPP_HPP
#define SPRIG_CONFIG_LIB_YAMLCPP_HPP

#ifdef SPRIG_CONFIG_LIB_USERCONFIG
#	include "../../../config/libconfig/yamlcpp.hpp"
#endif	// #ifdef SPRIG_CONFIG_LIB_USERCONFIG

#include <sprig/config/pragma_once.hpp>

#ifdef SPRIG_USING_PRAGMA_ONCE
#	pragma once
#endif	// #ifdef SPRIG_USING_PRAGMA_ONCE

#ifdef SPRIG_CONFIG_LIB_AUTO_LINK

#ifndef SPRIG_LIBCONFIG_YAMLCPP_BINARY
#	if defined(_MT) && defined(_DLL)
#		ifdef NDEBUG
#			ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT
#				define SPRIG_LIBCONFIG_YAMLCPP_BINARY SPRIG_LIBCONFIG_YAMLCPP_LIB_MT
#			endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT
#		else	// #ifdef NDEBUG
#			ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_GD
#				define SPRIG_LIBCONFIG_YAMLCPP_BINARY SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_GD
#			endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_GD
#		endif	// #ifdef NDEBUG
#	elif defined(_MT)
#		ifdef NDEBUG
#			ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_S
#				define SPRIG_LIBCONFIG_YAMLCPP_BINARY SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_S
#			endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_S
#		else	// #ifdef NDEBUG
#			ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_SGD
#				define SPRIG_LIBCONFIG_YAMLCPP_BINARY SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_SGD
#			endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_LIB_MT_SGD
#		endif	// #ifdef NDEBUG
#	endif
#endif	// #ifndef SPRIG_LIBCONFIG_YAMLCPP_BINARY

#include <boost/preprocessor/stringize.hpp>
#include <sprig/config/pragma_comment.hpp>

#ifdef SPRIG_HAS_PRAGMA_COMMENT
#	ifdef SPRIG_LIBCONFIG_YAMLCPP_BINARY
#		pragma comment(lib, BOOST_PP_STRINGIZE(SPRIG_LIBCONFIG_YAMLCPP_BINARY))
#	endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_BINARY
#endif	// #ifdef SPRIG_HAS_PRAGMA_COMMENT

#include <sprig/config/pragma_message.hpp>

#ifdef SPRIG_HAS_PRAGMA_MESSAGE
#	pragma message("sprig/config/lib/yamlcpp.hpp")
#	ifdef SPRIG_LIBCONFIG_YAMLCPP_BINARY
#		pragma message("    lib=" BOOST_PP_STRINGIZE(SPRIG_LIBCONFIG_YAMLCPP_BINARY))
#	endif	// #ifdef SPRIG_LIBCONFIG_YAMLCPP_BINARY
#endif	// #ifdef SPRIG_HAS_PRAGMA_MESSAGE

#endif	// #ifdef SPRIG_CONFIG_LIB_AUTO_LINK

#include <sprig/config/libinfo/yamlcpp.hpp>

#endif	// #ifndef SPRIG_CONFIG_LIB_YAMLCPP_HPP

max_stars_repo_name: bolero-MURAKAMI/Sprig

max_issues_repo_name: bolero-MURAKAMI/Sprig

max_forks_repo_name: bolero-MURAKAMI/Sprig


text:
#include <boost/test/unit_test.hpp>

#include <fc/io/json.hpp>
#include <scorum/chain/genesis/genesis_state.hpp>

namespace sc = scorum::chain;
namespace sp = scorum::protocol;

BOOST_AUTO_TEST_SUITE(deserialize_genesis_state)

BOOST_AUTO_TEST_CASE(check_accounts_fields)
{
    const std::string genesis_str = R"json(
                                    {
                                        "accounts":[
                                        {
                                            "name":"user",
                                            "public_key":"SCR1111111111111111111111111111111114T1Anm",
                                            "scr_amount":"0.000001000 SCR"
                                        }]
                                    }
                                    )json";

    const sc::genesis_state_type genesis_state = fc::json::from_string(genesis_str).as<sc::genesis_state_type>();

    BOOST_REQUIRE(genesis_state.accounts.size() == 1);

    sc::genesis_state_type::account_type account = genesis_state.accounts.front();

    BOOST_CHECK(account.name == "user");
    BOOST_CHECK(account.public_key == sp::public_key_type("SCR1111111111111111111111111111111114T1Anm"));
    BOOST_CHECK(account.scr_amount == sp::asset(1000, SCORUM_SYMBOL));
}

BOOST_AUTO_TEST_CASE(check_witness_fields)
{
    const std::string genesis_str = R"json(
                                    {
                                        "witness_candidates":[
                                        {
                                            "name":"user",
                                            "block_signing_key":"SCR1111111111111111111111111111111114T1Anm"
                                        }]
                                    }
                                    )json";

    const sc::genesis_state_type genesis_state = fc::json::from_string(genesis_str).as<sc::genesis_state_type>();

    BOOST_REQUIRE(genesis_state.witness_candidates.size() == 1);

    sc::genesis_state_type::witness_type w = genesis_state.witness_candidates.front();

    BOOST_CHECK(w.name == "user");
    BOOST_CHECK(w.block_signing_key == sp::public_key_type("SCR1111111111111111111111111111111114T1Anm"));
}

BOOST_AUTO_TEST_CASE(check_initial_timestamp)
{
    const std::string genesis_str = R"json({"initial_timestamp": "2017-11-28T14:48:10"})json";

    const sc::genesis_state_type genesis_state = fc::json::from_string(genesis_str).as<sc::genesis_state_type>();

    BOOST_CHECK(genesis_state.initial_timestamp == fc::time_point_sec(1511880490));
}

BOOST_AUTO_TEST_CASE(check_initial_supply)
{
    std::string genesis_str = R"json({ "accounts_supply": "1.000000000 SCR"})json";

    sc::genesis_state_type genesis_state = fc::json::from_string(genesis_str).as<sc::genesis_state_type>();

    BOOST_CHECK(genesis_state.accounts_supply.amount == 1000000000);
    BOOST_CHECK(genesis_state.accounts_supply.symbol() == SCORUM_SYMBOL);
}

BOOST_AUTO_TEST_CASE(check_rewards_supply)
{
    std::string genesis_str = R"json({ "rewards_supply": "1.000000000 SCR"})json";

    sc::genesis_state_type genesis_state = fc::json::from_string(genesis_str).as<sc::genesis_state_type>();

    BOOST_CHECK(genesis_state.rewards_supply.amount == 1000000000);
    BOOST_CHECK(genesis_state.rewards_supply.symbol() == SCORUM_SYMBOL);
}

BOOST_AUTO_TEST_SUITE_END()

max_stars_repo_name: scorum/scorum

max_issues_repo_name: Scorum/Scorum

max_forks_repo_name: Scorum/Scorum


text:
//==============================================================================
//         Copyright 2003 - 2011   LASMEA UMR 6602 CNRS/Univ. Clermont II
//         Copyright 2009 - 2011   LRI    UMR 8623 CNRS/Univ Paris Sud XI
//
//          Distributed under the Boost Software License, Version 1.0.
//                 See accompanying file LICENSE.txt or copy at
//                     http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef NT2_EXPONENTIAL_CONSTANTS_EXP_1_HPP_INCLUDED
#define NT2_EXPONENTIAL_CONSTANTS_EXP_1_HPP_INCLUDED

#include <nt2/include/functor.hpp>
#include <boost/simd/constant/hierarchy.hpp>
#include <boost/simd/constant/register.hpp>

namespace nt2
{
  namespace tag
  {
    /*!
      @brief Exp_1 generic tag

      Represents the Exp_1 constant in generic contexts.

      @par Models:
      Hierarchy
    **/
    BOOST_SIMD_CONSTANT_REGISTER( Exp_1, double
                                , 2, 0x402df854
                                , 0x4005bf0a8b145769LL
                                )
  }
  namespace ext
  {
    template<class Site>
    BOOST_FORCEINLINE generic_dispatcher<tag::Exp_1, Site> dispatching_Exp_1(adl_helper, boost::dispatch::meta::unknown_<Site>, ...)
    {
      return generic_dispatcher<tag::Exp_1, Site>();
    }
    template<class... Args>
    struct impl_Exp_1;
  }
  /*!
    Generates constant e.

    @par Semantic:
    The e constant is the real number such that \f$\log(e) = 1\f$

    @code
    T r = Exp_1<T>();
    @endcode

    is similar to:

    @code
      r =  T(2.71828182845904523536028747135266249775724709369995);
    @endcode

  **/
  BOOST_SIMD_CONSTANT_IMPLEMENTATION(tag::Exp_1, Exp_1);
}

#endif


text:
#include "Lab.h"
#include "RuntimeLevel.h"
#include "Inf.h"
#include "Atx.h"

#include <iostream>
#include <boost/exception/all.hpp>

std::string labFilePath;

lab_fuse::Lab lab;

int main(int argc, char *argv[])
{
    using namespace outlaws;
    try {
        //lab = lab_fuse::loadLabFile(labFilePath);

#if 0
        auto instructions = loadAtx(R"(F:\VSProjects\OutlawsXDir\OutlawsX\OutlawsLib\antlr\AtxInput.txt)");
        AtxItem item(0, AtxWallKind::MID, 0, instructions);
        bool trigger = false;
        LvtLevel dummyLevel;
        while (true) {
            item.update(dummyLevel, 0.1f);
            if (trigger)
                item.trigger(dummyLevel, 0);
        }

        loadInf(R"(F:\GOG Games\Outlaws\hideoutz.INF)");
#endif

        auto lvt = loadLvt(R"(F:\VSProjects\OutlawsXDir\trash\HIDEOUT.LVT)");
        auto texInfos = loadTexInfos(R"(F:\VSProjects\OutlawsXDir\UnityProj0\UnityProj0\Assets\Textures\pack.json)");

        RuntimeLevel level(std::move(lvt), texInfos);
        level.computeMeshes();
    }
    catch (...) {
        std::cerr << boost::current_exception_diagnostic_information() << std::endl;
        return 1;
    }

    return 0;
}

max_stars_repo_name: Zbyl/OutlawsX

max_issues_repo_name: Zbyl/OutlawsX

max_forks_repo_name: Zbyl/OutlawsX