text:
/*===================================================================

MSI applications for interactive analysis in MITK (M2aia)

Copyright (c) Jonas Cordes

All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt for details.

===================================================================*/

#include <m2ElxRegistrationHelper.h>
#include <m2ElxUtil.h>
#include <m2TestingConfig.h>
#include <mitkImageCast.h>
#include <mitkImagePixelWriteAccessor.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>

//#include <boost/algorithm/string.hpp>

class m2ElxUtilTestSuite : public mitk::TestFixture
{
  CPPUNIT_TEST_SUITE(m2ElxUtilTestSuite);
  MITK_TEST(FindElastixExecutables);
  MITK_TEST(CheckGetRegistrationInputs_10x10x10_ThrowException);
  MITK_TEST(CheckGetRegistrationInputs_10x10x1_NoThrowException);
  MITK_TEST(CheckGetRegistrationInputs_10x10_NoThrowException);
  MITK_TEST(CheckGetRegistrationOutput_10x10_NoThrowException);
  MITK_TEST(CheckGetRegistrationInputs_10x10x10x1_ThrowException);
  CPPUNIT_TEST_SUITE_END();

public:
  using ItkType4D = itk::Image<unsigned short, 4>;
  using ItkType3D = itk::Image<unsigned short, 3>;
  using ItkType2D = itk::Image<unsigned short, 2>;

  void FindElastixExecutables() { m2::ElxUtil::Executable("elastix"); }

  void CheckGetRegistrationInputs_10x10x10_ThrowException()
  {
    auto itkNoSlice3D = ItkType3D::New();
    itkNoSlice3D->SetRegions({{0, 0, 0}, {10, 10, 10}});
    itkNoSlice3D->Allocate(0);
    itkNoSlice3D->Initialize();
    auto mitkNoSlice3D = mitk::Image::New();
    mitkNoSlice3D->InitializeByItk(itkNoSlice3D.GetPointer());

    m2::ElxRegistrationHelper helper;
    CPPUNIT_ASSERT_THROW(helper.SetImageData(mitkNoSlice3D, mitkNoSlice3D), mitk::Exception);
  }

  void CheckGetRegistrationInputs_10x10x10x1_ThrowException()
  {
    auto itkNoSlice4D = ItkType4D::New();
    itkNoSlice4D->SetRegions({{0, 0, 0, 0}, {10, 10, 10, 1}});
    itkNoSlice4D->Allocate(0);
    itkNoSlice4D->Initialize();
    auto mitkNoSlice4D = mitk::Image::New();
    mitkNoSlice4D->InitializeByItk(itkNoSlice4D.GetPointer());

    m2::ElxRegistrationHelper helper;
    CPPUNIT_ASSERT_THROW(helper.SetImageData(mitkNoSlice4D, mitkNoSlice4D), mitk::Exception);
  }

  void CheckGetRegistrationInputs_10x10x1_NoThrowException()
  {
    auto itkSlice3D = ItkType3D::New();
    itkSlice3D->SetRegions({{0, 0, 0}, {10, 10, 1}});
    itkSlice3D->Allocate(0);
    itkSlice3D->Initialize();
    auto mitkSlice3D = mitk::Image::New();
    mitkSlice3D->InitializeByItk(itkSlice3D.GetPointer());

    m2::ElxRegistrationHelper helper;
    CPPUNIT_ASSERT_NO_THROW(helper.SetImageData(mitkSlice3D, mitkSlice3D));
  }

  void CheckGetRegistrationInputs_10x10_NoThrowException()
  {
    auto itkSlice2D = ItkType2D::New();
    itkSlice2D->SetRegions({{0, 0}, {10, 10}});
    itkSlice2D->Allocate(0);
    itkSlice2D->Initialize();
    auto mitkSlice2D = mitk::Image::New();
    mitkSlice2D->InitializeByItk(itkSlice2D.GetPointer());

    m2::ElxRegistrationHelper helper;
    CPPUNIT_ASSERT_THROW(helper.SetImageData(mitkSlice2D, mitkSlice2D), mitk::Exception);
  }

  void CheckGetRegistrationOutput_10x10_NoThrowException()
  {
    mitk::Image::Pointer fixed, fixedMask, moving, movingMask;
    auto data = mitk::IOUtil::Load({GetTestDataFilePath("fixed.nrrd", M2AIA_DATA_DIR),
                                    GetTestDataFilePath("fixedMask.nrrd", M2AIA_DATA_DIR),
                                    GetTestDataFilePath("moving.nrrd", M2AIA_DATA_DIR),
                                    GetTestDataFilePath("movingMask.nrrd", M2AIA_DATA_DIR)});

    fixed = dynamic_cast<mitk::Image *>(data.at(0).GetPointer());
    fixedMask = dynamic_cast<mitk::Image *>(data.at(1).GetPointer());
    // fixedMask = nullptr;
    moving = dynamic_cast<mitk::Image *>(data.at(2).GetPointer());
    movingMask = dynamic_cast<mitk::Image *>(data.at(3).GetPointer());
    // movingMask = nullptr;
    const auto rigid = GetTestDataFilePath("rigid.txt", M2AIA_DATA_DIR);
    const auto deformable = GetTestDataFilePath("deformable.txt", M2AIA_DATA_DIR);

    m2::ElxRegistrationHelper helper;
    helper.SetImageData(fixed, moving);
    helper.SetMaskData(fixedMask, movingMask);

    {
      helper.SetRegistrationParameters({rigid, deformable});
      helper.GetRegistration();
      CPPUNIT_ASSERT_EQUAL(size_t(2), helper.GetTransformation().size());
    }

    {
      mitk::Image::Pointer d = helper.WarpImage(moving);
      const auto actualSpacing = d->GetGeometry()->GetSpacing()[2];
      CPPUNIT_ASSERT_DOUBLES_EQUAL(0.01, actualSpacing, mitk::eps);
    }
    {
      mitk::Image::Pointer dm = helper.WarpImage(movingMask, "unsigned short", 0);
      const auto actualSpacing = dm->GetGeometry()->GetSpacing()[2];
      CPPUNIT_ASSERT_DOUBLES_EQUAL(0.01, actualSpacing, mitk::eps);
    }
  }
};

MITK_TEST_SUITE_REGISTRATION(m2ElxUtil)

ext: cpp


text:
#ifndef CQL_ROUND_ROBIN_POLICY_HPP_
#define CQL_ROUND_ROBIN_POLICY_HPP_

#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/thread/mutex.hpp>

#include "cql/policies/cql_load_balancing_policy.hpp"

namespace cql {
	class cql_host_t;
    class cql_cluster_t;

	class cql_round_robin_query_plan_t :
        public cql_query_plan_t
    {
	public:
		cql_round_robin_query_plan_t(
			const cql_cluster_t* cluster,
			unsigned             index);

		// Returns next host to query.
		virtual boost::shared_ptr<cql_host_t>
		next_host_to_query();

	private:
        boost::mutex                                _mutex;
		unsigned									_index;
		unsigned									_current;
		std::vector<boost::shared_ptr<cql_host_t> >	_hosts;
	};

	class CQL_EXPORT cql_round_robin_policy_t :
		public cql_load_balancing_policy_t,
		boost::noncopyable
	{
	public:
		cql_round_robin_policy_t() :
            _cluster(),
            _index(0)
        {}

		virtual cql_host_distance_enum
		distance(
            const cql_host_t& host);

		virtual boost::shared_ptr<cql_query_plan_t>
		new_query_plan(
            const boost::shared_ptr<cql_query_t>& query);

    protected:

        virtual void
		init(
            cql_cluster_t* cluster);

	private:
        boost::mutex   _mutex;
		cql_cluster_t* _cluster;
		unsigned       _index;
	};
}

#endif

ext: hpp

max_stars_repo_name: stanislav-podlesny/cpp-driver

max_issues_repo_name: stanislav-podlesny/cpp-driver

max_forks_repo_name: stanislav-podlesny/cpp-driver


text:
/**
 * @copyright Copyright (c) 2017 B-com http://www.b-com.com/
 *
 * 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.
 *
 * @author Loïc Touraine
 *
 * @file
 * @brief description of file
 * @date 2017-04-28
 */

#include "xpcf/api/InterfaceMetadata.h"
#include <boost/uuid/uuid_generators.hpp>

namespace org { namespace bcom { namespace xpcf {

using namespace uuids;

class InterfaceMetadata::InterfaceMetadataImpl {
public:
    InterfaceMetadataImpl(const char * name, const uuids::uuid& interfaceUUID, const char * description);
    InterfaceMetadataImpl(const char * name, const char * interfaceUUID, const char * description);
    std::basic_string<char> m_name;
    std::basic_string<char> m_description;
    uuids::uuid m_uuid;
    void setUUID(const char * elementUUID);
};

InterfaceMetadata::InterfaceMetadata(const char* name, const uuid& interfaceUUID, const char * description):
    m_pimpl(new InterfaceMetadataImpl(name,interfaceUUID,description))
{
}

InterfaceMetadata::InterfaceMetadata(const char* name, const char * interfaceUUID, const char * description):
    m_pimpl(new InterfaceMetadataImpl(name,interfaceUUID,description))
{
}

InterfaceMetadata::InterfaceMetadata(const InterfaceMetadata & other)
{
    m_pimpl = unixpcf::make_unique<InterfaceMetadataImpl>(other.name(),other.getUUID(),other.description());
}

InterfaceMetadata::InterfaceMetadata(InterfaceMetadata && other)
{
    this->m_pimpl = std::move(other.m_pimpl);
}

InterfaceMetadata::~InterfaceMetadata()
{
}

const char * InterfaceMetadata::name() const
{
    return m_pimpl->m_name.c_str();
}

const char * InterfaceMetadata::description() const
{
    return m_pimpl->m_description.c_str();
}

uuids::uuid InterfaceMetadata::getUUID() const
{
    return m_pimpl->m_uuid;
}

InterfaceMetadata & InterfaceMetadata::operator=(const InterfaceMetadata & other)
{
    m_pimpl->m_description = other.description();
    m_pimpl->m_name = other.name();
    m_pimpl->m_uuid = other.getUUID();
    return * this;
}

InterfaceMetadata & InterfaceMetadata::operator=(InterfaceMetadata && other)
{
    this->m_pimpl = std::move(other.m_pimpl);
    return * this;
}

bool InterfaceMetadata::operator==(const InterfaceMetadata & c)
{
    if ((strcmp(c.description(),this->description()) ==0) &&
            c.getUUID() == this->getUUID() &&
            (strcmp(c.name(),this->name()) ==0)) {
        return true;
    }
    return false;
}

InterfaceMetadata::InterfaceMetadataImpl::InterfaceMetadataImpl(const char * name, const uuids::uuid& interfaceUUID, const char * description):
    m_name(name),m_uuid(interfaceUUID),m_description(description)
{
}

InterfaceMetadata::InterfaceMetadataImpl::InterfaceMetadataImpl(const char * name, const char * interfaceUUID, const char * description):
    m_name(name),m_description(description)
{
    setUUID(interfaceUUID);
}

void InterfaceMetadata::InterfaceMetadataImpl::setUUID(const char *elementUUID)
{
    if (elementUUID != nullptr) {
        m_uuid = xpcf::toUUID(elementUUID);
    }
}

}}} //namespace org::bcom::xpcf

max_stars_repo_name: b-com-software-basis/xpcf

max_issues_repo_name: b-com-software-basis/xpcf

max_forks_repo_name: b-com-software-basis/xpcf


text:
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// 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)

/// \file detail/set_view_base.hpp
/// \brief Helper base for the construction of the bimap views types.

#ifndef BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP
#define BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP

#if defined(_MSC_VER)
#pragma once
#endif

#include <boost/config.hpp>

#include <boost/bimap/relation/member_at.hpp>
#include <boost/bimap/relation/support/data_extractor.hpp>
#include <boost/bimap/detail/modifier_adaptor.hpp>
#include <boost/bimap/detail/set_view_iterator.hpp>
#include <boost/bimap/relation/support/get_pair_functor.hpp>
#include <boost/bimap/relation/detail/to_mutable_relation_functor.hpp>
#include <boost/bimap/relation/mutant_relation.hpp>
#include <boost/bimap/container_adaptor/support/iterator_facade_converters.hpp>

namespace boost {
namespace bimaps {
namespace detail {

template< class Key, class Value, class KeyToBase >
class set_view_key_to_base
{
    public:
    const Key operator()( const Value & v ) const
    {
        return keyToBase( v );
    }
    private:
    KeyToBase keyToBase;
};

template< class MutantRelationStorage, class KeyToBase >
class set_view_key_to_base<MutantRelationStorage,MutantRelationStorage,KeyToBase>
{
    typedef BOOST_DEDUCED_TYPENAME MutantRelationStorage::non_mutable_storage non_mutable_storage;
    public:
    const MutantRelationStorage & operator()( const non_mutable_storage & k ) const
    {
        return ::boost::bimaps::relation::detail::mutate<MutantRelationStorage>(k);
    }
    const MutantRelationStorage & operator()( const MutantRelationStorage & k ) const
    {
        return k;
    }
};

// The next macro can be converted in a metafunctor to gain code robustness.
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(                               \
    CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER               \
)                                                                             \
::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR                         \
<                                                                             \
    CORE_INDEX,                                                               \
    ::boost::bimaps::detail::                                                 \
              set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator         >,    \
    ::boost::bimaps::detail::                                                 \
        const_set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator   >,    \
    ::boost::bimaps::detail::                                                 \
              set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER       >,    \
    ::boost::bimaps::detail::                                                 \
        const_set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >,    \
    ::boost::bimaps::container_adaptor::support::iterator_facade_to_base      \
    <                                                                         \
        ::boost::bimaps::detail::      set_view_iterator<                     \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>,                     \
        ::boost::bimaps::detail::const_set_view_iterator<                     \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator>                \
                                                                              \
    >,                                                                        \
    ::boost::mpl::na,                                                         \
    ::boost::mpl::na,                                                         \
    ::boost::bimaps::relation::detail::                                       \
        get_mutable_relation_functor<                                         \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >,                  \
    ::boost::bimaps::relation::support::                                      \
        get_above_view_functor<                                               \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >,                  \
    ::boost::bimaps::detail::set_view_key_to_base<                            \
        BOOST_DEDUCED_TYPENAME CORE_INDEX::key_type,                          \
        BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type,                        \
        BOOST_DEDUCED_TYPENAME CORE_INDEX::key_from_value                     \
    >                                                                         \
>
/*===========================================================================*/

/*===========================================================================*/
#define BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR(                     \
    CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER               \
)                                                                             \
::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR                         \
<                                                                             \
    CORE_INDEX,                                                               \
    ::boost::bimaps::detail::                                                 \
              set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator         >,    \
    ::boost::bimaps::detail::                                                 \
        const_set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator   >,    \
    ::boost::bimaps::detail::                                                 \
              set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER       >,    \
    ::boost::bimaps::detail::                                                 \
        const_set_view_iterator<                                              \
                    BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >,    \
    ::boost::bimaps::container_adaptor::support::iterator_facade_to_base      \
    <                                                                         \
        ::boost::bimaps::detail::      set_view_iterator<                     \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>,                     \
        ::boost::bimaps::detail::const_set_view_iterator<                     \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator>                \
                                                                              \
    >,                                                                        \
    ::boost::mpl::na,                                                         \
    ::boost::mpl::na,                                                         \
    ::boost::bimaps::relation::detail::                                       \
        get_mutable_relation_functor<                                         \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >,                  \
    ::boost::bimaps::relation::support::                                      \
        get_above_view_functor<                                               \
            BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >                   \
>
/*===========================================================================*/

#if defined(BOOST_MSVC)
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE)                     \
    typedef ::boost::bimaps::detail::set_view_base<                           \
        TYPE< INDEX_TYPE >, INDEX_TYPE > template_class_friend;               \
    friend class template_class_friend;
/*===========================================================================*/
#else
/*===========================================================================*/
#define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE)                     \
    friend class ::boost::bimaps::detail::set_view_base<                      \
        TYPE< INDEX_TYPE >, INDEX_TYPE >;
/*===========================================================================*/
#endif

/// \brief Common base for set views.

template< class Derived, class Index >
class set_view_base
{
    typedef ::boost::bimaps::container_adaptor::support::
    iterator_facade_to_base
    <
        ::boost::bimaps::detail::
                  set_view_iterator<BOOST_DEDUCED_TYPENAME Index::      iterator>,
        ::boost::bimaps::detail::
            const_set_view_iterator<BOOST_DEDUCED_TYPENAME Index::const_iterator>

    > iterator_to_base_;

    typedef BOOST_DEDUCED_TYPENAME Index::value_type::left_value_type          left_type_;

    typedef BOOST_DEDUCED_TYPENAME Index::value_type::right_value_type        right_type_;

    typedef BOOST_DEDUCED_TYPENAME Index::value_type                          value_type_;

    typedef ::boost::bimaps::detail::
                    set_view_iterator<BOOST_DEDUCED_TYPENAME Index::iterator>   iterator_;

    public:

    bool replace(iterator_ position,
                 const value_type_ & x)
    {
        return derived().base().replace(
            derived().template functor<iterator_to_base_>()(position),x
        );
    }

    template< class CompatibleLeftType >
    bool replace_left(iterator_ position,
                      const CompatibleLeftType & l)
    {
        return derived().base().replace(
            derived().template functor<iterator_to_base_>()(position),
            ::boost::bimaps::relation::detail::copy_with_left_replaced(*position,l)
        );
    }

    template< class CompatibleRightType >
    bool replace_right(iterator_ position,
                       const CompatibleRightType & r)
    {
        return derived().base().replace(
            derived().template functor<iterator_to_base_>()(position),
            ::boost::bimaps::relation::detail::copy_with_right_replaced(*position,r)
        );
    }

    /* This function may be provided in the future

    template< class Modifier >
    bool modify(iterator_ position,
                Modifier mod)
    {
        return derived().base().modify(

            derived().template functor<iterator_to_base_>()(position),

            ::boost::bimaps::detail::relation_modifier_adaptor
            <
                Modifier,
                BOOST_DEDUCED_TYPENAME Index::value_type,
                BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
                data_extractor
                <
                    ::boost::bimaps::relation::member_at::left,
                    BOOST_DEDUCED_TYPENAME Index::value_type

                >::type,
                BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
                data_extractor
                <
                    ::boost::bimaps::relation::member_at::right,
                    BOOST_DEDUCED_TYPENAME Index::value_type

                >::type

            >(mod)
        );
    }
    */
    /*
    template< class Modifier >
    bool modify_left(iterator_ position, Modifier mod)
    {
        typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
        data_extractor
        <
            BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right,
            BOOST_DEDUCED_TYPENAME Index::value_type

        >::type left_data_extractor_;

        return derived().base().modify(

            derived().template functor<iterator_to_base_>()(position),

            // this may be replaced later by
            // ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) )

            ::boost::bimaps::detail::unary_modifier_adaptor
            <
                Modifier,
                BOOST_DEDUCED_TYPENAME Index::value_type,
                left_data_extractor_

            >(mod)
        );
    }

    template< class Modifier >
    bool modify_right(iterator_ position, Modifier mod)
    {
        typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::
        data_extractor
        <
            BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right,
            BOOST_DEDUCED_TYPENAME Index::value_type

        >::type right_data_extractor_;

        return derived().base().modify(

            derived().template functor<iterator_to_base_>()(position),

            // this may be replaced later by
            // ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) )

            ::boost::bimaps::detail::unary_modifier_adaptor
            <
                Modifier,
                BOOST_DEDUCED_TYPENAME Index::value_type,
                right_data_extractor_

            >(mod)
        );
    }
    */
    protected:

    typedef set_view_base set_view_base_;

    private:

    // Curiously Recurring Template interface.

    Derived& derived()
    {
        return *static_cast<Derived*>(this);
    }

    Derived const& derived() const
    {
        return *static_cast<Derived const*>(this);
    }
};

} // namespace detail
} // namespace bimaps
} // namespace boost

#endif // BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP


text: #include <boost/spirit/home/lex/lexer/lexertl/generate_static.hpp>

max_stars_repo_name: miathedev/BoostForArduino

max_issues_repo_name: miathedev/BoostForArduino

max_forks_repo_name: miathedev/BoostForArduino


text: #include <boost/smart_ptr/local_shared_ptr.hpp>


text:
/* $Id: tree_view_node.cpp 49246 2011-04-17 07:32:56Z mordante $ */
/*
   Copyright (C) 2010 - 2011 by Mark de Wever <koraq@xs4all.nl>
   Part of the Battle for Wesnoth Project http://www.wesnoth.org/

   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 2 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.

   See the COPYING file for more details.
*/

#define GETTEXT_DOMAIN "wesnoth-lib"

#include "gui/widgets/tree_view_node.hpp"

#include "gettext.hpp"
#include "gui/auxiliary/log.hpp"
#include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/toggle_panel.hpp"
#include "gui/widgets/tree_view.hpp"

#include <boost/bind.hpp>

#define LOG_SCOPE_HEADER \
		get_control_type() + " [" + tree_view().id() + "] " + __func__
#define LOG_HEADER LOG_SCOPE_HEADER + ':'

namespace gui2 {

ttree_view_node::ttree_view_node(const std::string& id
		, const std::vector<tnode_definition>& node_definitions
		, ttree_view_node* parent_node
		, ttree_view& parent_tree_view
		, const std::map<std::string /* widget id */, string_map>& data)
	: twidget()
	, parent_node_(parent_node)
	, tree_view_(parent_tree_view)
	, grid_()
	, children_()
	, node_definitions_(node_definitions)
	, icon_(NULL)
	, label_(NULL)
{
	grid_.set_parent(this);
	set_parent(&parent_tree_view);
	if(id != "root") {
		foreach(const tnode_definition& node_definition, node_definitions_) {
			if(node_definition.id == id) {
				node_definition.builder->build(&grid_);
				init_grid(&grid_, data);

				icon_ = find_widget<ttoggle_button>(
						  &grid_
						, "tree_view_node_icon"
						, false
						, false);

				if(icon_) {
					icon_->set_visible(twidget::HIDDEN);
					icon_->connect_signal<event::LEFT_BUTTON_CLICK>(
							boost::bind(&ttree_view_node::
								signal_handler_left_button_click
								, this, _2));

				}

				if(parent_node_ && parent_node_->icon_) {
					parent_node_->icon_->set_visible(twidget::VISIBLE);
				}

				twidget& widget = find_widget<twidget>(
						  &grid_
						, "tree_view_node_label"
						, false);

				label_ = dynamic_cast<tselectable_*>(&widget);
				if(label_) {
					widget.connect_signal<event::LEFT_BUTTON_CLICK>(
							  boost::bind(&ttree_view_node::
								signal_handler_label_left_button_click
								, this, _2, _3, _4)
							, event::tdispatcher::front_child);
					widget.connect_signal<event::LEFT_BUTTON_CLICK>(
							  boost::bind(&ttree_view_node::
								signal_handler_label_left_button_click
								, this, _2, _3, _4)
							, event::tdispatcher::front_pre_child);

					if(!tree_view().selected_item_) {
						tree_view().selected_item_ = this;
						label_->set_value(true);
					}
				}

				return;
			}
		}

		VALIDATE(false, _("Unknown builder id for tree view node."));
	}
}

ttree_view_node::~ttree_view_node()
{
	if(/*tree_view() &&*/ tree_view().selected_item_ == this) {
		tree_view().selected_item_ = NULL;
	}
}

ttree_view_node& ttree_view_node::add_child(
		  const std::string& id
		, const std::map<std::string /* widget id */, string_map>& data
		, const int index)
{

	boost::ptr_vector<ttree_view_node>::iterator itor = children_.end();

	if(static_cast<size_t>(index) < children_.size()) {
		itor = children_.begin() + index;
	}

	itor = children_.insert(itor, new ttree_view_node(
			  id
			, node_definitions_
			, this
			, tree_view()
			, data));

	if(is_folded() || is_root_node()) {
		return *itor;
	}

	if(tree_view().get_size() == tpoint(0, 0)) {
		return *itor;
	}

	assert(tree_view().content_grid());
	const int current_width = tree_view().content_grid()->get_width();

	// Calculate width modification.
	tpoint best_size = itor->get_best_size();
	best_size.x += get_indention_level() * tree_view().indention_step_size_;
	const unsigned width_modification = best_size.x > current_width
			? best_size.x - current_width
			: 0;

	// Calculate height modification.
	const int height_modification = best_size.y;
	assert(height_modification > 0);

	// Request new size.
	tree_view().resize_content(width_modification, height_modification);

	return *itor;
}

unsigned ttree_view_node::get_indention_level() const
{
	unsigned level = 0;

	const ttree_view_node* node = this;
	while(!node->is_root_node()) {
		node = &node->parent_node();
		++level;
	}

	return level;
}

ttree_view_node& ttree_view_node::parent_node()
{
	assert(!is_root_node());
	return *parent_node_;
}

const ttree_view_node& ttree_view_node::parent_node() const
{
	assert(!is_root_node());
	return *parent_node_;
}

ttree_view& ttree_view_node::tree_view()
{
	return tree_view_;
}

const ttree_view& ttree_view_node::tree_view() const
{
	return tree_view_;
}

bool ttree_view_node::is_folded() const
{
	return icon_ && icon_->get_value();
}
#if 0
void ttree_view_node::fold(const bool /*recursive*/)
{
	// FIXME set state

}

void ttree_view_node::unfold(const texpand_mode /*mode*/)
{
	// FIXME set state

}
#endif

void ttree_view_node::clear()
{
	/** @todo Also try to find the optimal width. */
	int height_reduction = 0;

	if(!is_folded()) {
		foreach(const ttree_view_node& node, children_) {
			height_reduction += node.get_current_size().y;
		}
	}

	children_.clear();

	if(height_reduction == 0) {
		return;
	}

	tree_view().resize_content(0, -height_reduction);
}

struct ttree_view_node_implementation
{
	template<class W>
	static W* find_at(
			  typename tconst_duplicator<W, ttree_view_node>::type&
				tree_view_node
			, const tpoint& coordinate, const bool must_be_active)
	{
		if(W* widget =
				tree_view_node.grid_.find_at(coordinate, must_be_active)) {

			return widget;
		}

		if(tree_view_node.is_folded()) {
			return NULL;
		}

		typedef typename tconst_duplicator<W, ttree_view_node>::type thack;
		foreach(thack& node, tree_view_node.children_) {
			if(W* widget = node.find_at(coordinate, must_be_active)) {
				return widget;
			}
		}

		return NULL;
	}
};

twidget* ttree_view_node::find_at(
		  const tpoint& coordinate
		, const bool must_be_active)
{
	return ttree_view_node_implementation::find_at<twidget>(
			*this, coordinate, must_be_active);
}

const twidget* ttree_view_node::find_at(
		  const tpoint& coordinate
		, const bool must_be_active) const
{
	return ttree_view_node_implementation::find_at<const twidget>(
			*this, coordinate, must_be_active);
}

void ttree_view_node::impl_populate_dirty_list(twindow& caller
		, const std::vector<twidget*>& call_stack)
{
	std::vector<twidget*> child_call_stack = call_stack;
	grid_.populate_dirty_list(caller, child_call_stack);

	if(is_folded()) {
		return;
	}

	foreach(ttree_view_node& node, children_) {
		std::vector<twidget*> child_call_stack = call_stack;
		node.impl_populate_dirty_list(caller, child_call_stack);
	}
}

tpoint ttree_view_node::calculate_best_size() const
{
	return calculate_best_size(-1, tree_view().indention_step_size_);
}

tpoint ttree_view_node::get_current_size() const
{
	if(parent_node_ && parent_node_->is_folded()) {
		return tpoint(0, 0);
	}

	tpoint size = get_folded_size();
	if(is_folded()) {
		return size;
	}

	foreach(const ttree_view_node& node, children_) {

		if(node.grid_.get_visible() == twidget::INVISIBLE) {
			continue;
		}

		tpoint node_size = node.get_current_size();

		size.y += node_size.y;
		size.x = std::max(size.x, node_size.x);
	}

	return size;
}

tpoint ttree_view_node::get_folded_size() const
{
	tpoint size = grid_.get_size();
	if(get_indention_level() > 1) {
		size.x += (get_indention_level() - 1) * tree_view().indention_step_size_;
	}
	return size;
}

tpoint ttree_view_node::get_unfolded_size() const
{
	tpoint size = grid_.get_best_size();
	if(get_indention_level() > 1) {
		size.x += (get_indention_level() - 1) * tree_view().indention_step_size_;
	}

	foreach(const ttree_view_node& node, children_) {

		if(node.grid_.get_visible() == twidget::INVISIBLE) {
			continue;
		}

		tpoint node_size = node.get_unfolded_size();

		size.y += node_size.y;
		size.x = std::max(size.x, node_size.x);
	}

	return size;
}

tpoint ttree_view_node::calculate_best_size(const int indention_level
		, const unsigned indention_step_size) const
{
	log_scope2(log_gui_layout, LOG_SCOPE_HEADER);

	tpoint best_size = grid_.get_best_size();
	if(indention_level > 0) {
		best_size.x += indention_level * indention_step_size;
	}

	if(is_folded()) {

		DBG_GUI_L << LOG_HEADER
				<< " Folded grid return own best size " << best_size << ".\n";
		return best_size;
	}

	DBG_GUI_L << LOG_HEADER << " own grid best size " << best_size << ".\n";

	foreach(const ttree_view_node& node, children_) {

		if(node.grid_.get_visible() == twidget::INVISIBLE) {
			continue;
		}

		const tpoint node_size = node.calculate_best_size(indention_level + 1,
				indention_step_size);

		best_size.y += node_size.y;
		best_size.x = std::max(best_size.x, node_size.x);
	}

	DBG_GUI_L << LOG_HEADER << " result " << best_size << ".\n";
	return best_size;
}

void ttree_view_node::set_origin(const tpoint& origin)
{
	// Inherited.
	twidget::set_origin(origin);

	// Using layout_children seems to fail.
	place(tree_view().indention_step_size_, origin, get_size().x);
}

void ttree_view_node::place(const tpoint& origin, const tpoint& size)
{
	// Inherited.
	twidget::place(origin, size);

	tree_view().layout_children(true);
}

unsigned ttree_view_node::place(
	  const unsigned indention_step_size
	, tpoint origin
	, unsigned width)
{
	log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
	DBG_GUI_L << LOG_HEADER << " origin " << origin << ".\n";

	const unsigned offset = origin.y;
	tpoint best_size = grid_.get_best_size();
	best_size.x = width;
	grid_.place(origin, best_size);

	if(!is_root_node()) {
		origin.x += indention_step_size;
		width -= indention_step_size;
	}
	origin.y += best_size.y;

	if(is_folded()) {
		DBG_GUI_L << LOG_HEADER << " folded node done.\n";
		return origin.y - offset;
	}

	DBG_GUI_L << LOG_HEADER << " set children.\n";
	foreach(ttree_view_node& node, children_) {
		origin.y += node.place(indention_step_size, origin, width);
	}

	// Inherited.
	twidget::set_size(tpoint(width, origin.y - offset));

	DBG_GUI_L << LOG_HEADER << " result " << ( origin.y - offset) << ".\n";
	return origin.y - offset;
}

void ttree_view_node::set_visible_area(const SDL_Rect& area)
{
	log_scope2(log_gui_layout, LOG_SCOPE_HEADER);
	DBG_GUI_L << LOG_HEADER << " area " << area << ".\n";
	grid_.set_visible_area(area);

	if(is_folded()) {
		DBG_GUI_L << LOG_HEADER << " folded node done.\n";
		return;
	}

	foreach(ttree_view_node& node, children_) {
		node.set_visible_area(area);
	}
}

void ttree_view_node::impl_draw_children(surface& frame_buffer)
{
	grid_.draw_children(frame_buffer);

	if(is_folded()) {
		return;
	}

	foreach(ttree_view_node& node, children_) {
		node.impl_draw_children(frame_buffer);
	}
}

void ttree_view_node::signal_handler_left_button_click(
		const event::tevent event)
{
	DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";

	/**
	 * @todo Rewrite this sizing code for the folding/unfolding.
	 *
	 * The code works but feels rather hacky, so better move back to the
	 * drawingboard for 1.9.
	 */

	// is_folded() returns the new state.
	if(is_folded()) {

		// From unfolded to folded.
		const tpoint current_size(get_current_size().x, get_unfolded_size().y);
		const tpoint new_size = get_folded_size();

		int width_modification = new_size.x - current_size.x;
		if(width_modification < 0) {
			width_modification = 0;
		}

		const int height_modification = new_size.y - current_size.y;
		assert(height_modification <= 0);

		tree_view().resize_content(width_modification, height_modification);
	} else {

		// From folded to unfolded.
		const tpoint current_size(get_current_size().x, get_folded_size().y);
		const tpoint new_size = get_unfolded_size();

		int width_modification = new_size.x - current_size.x;
		if(width_modification < 0) {
			width_modification = 0;
		}

		const int height_modification = new_size.y - current_size.y;
		assert(height_modification >= 0);

		tree_view().resize_content(width_modification, height_modification);
	}
}

void ttree_view_node::signal_handler_label_left_button_click(
		  const event::tevent event
		, bool& handled
		, bool& halt)
{
	DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";

	assert(label_);

	// We only snoop on the event so normally don't touch the handled, else if
	// we snoop in preexcept when halting.

	if(label_->get_value()) {
		// Forbid deselecting
		halt = handled = true;
	} else {
		// Deselect current item
		if(tree_view().selected_item_ && tree_view().selected_item_->label_) {
			tree_view().selected_item_->label_->set_value(false);
		}

		tree_view().selected_item_ = this;

		if(tree_view().selection_change_callback_) {
			tree_view().selection_change_callback_();
		}
	}
}

void ttree_view_node::init_grid(tgrid* grid
		, const std::map<std::string /* widget id */, string_map>& data)
{
	assert(grid);

	for(unsigned row = 0; row < grid->get_rows(); ++row) {
		for(unsigned col = 0; col < grid->get_cols(); ++col) {
			twidget* widget = grid->widget(row, col);
			assert(widget);

			tgrid* child_grid = dynamic_cast<tgrid*>(widget);
//			ttoggle_button* btn = dynamic_cast<ttoggle_button*>(widget);
			ttoggle_panel* panel = dynamic_cast<ttoggle_panel*>(widget);
			tcontrol* ctrl = dynamic_cast<tcontrol*>(widget);

			if(panel) {
				panel->set_child_members(data);
			} else if(child_grid) {
				init_grid(child_grid, data);
			} else if(ctrl) {
				std::map<std::string, string_map>::const_iterator itor =
						data.find(ctrl->id());

				if(itor == data.end()) {
					itor = data.find("");
				}
				if(itor != data.end()) {
					ctrl->set_members(itor->second);
				}
//				ctrl->set_members(data);
			} else {

//				ERROR_LOG("Widget type '"
//						<< typeid(*widget).name() << "'.");
			}
		}
	}

}

const std::string& ttree_view_node::get_control_type() const
{
	static const std::string type = "tree_view_node";
	return type;
}

} // namespace gui2

max_stars_repo_name: blackberry/Wesnoth

max_issues_repo_name: blackberry/Wesnoth

max_forks_repo_name: blackberry/Wesnoth


text:
#pragma once

#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <dlib/geometry.h>

namespace misc
{
    // This function comes from user763305 @ http://stackoverflow.com/questions/6089231/getting-std-ifstream-to-handle-lf-cr-and-crlf
    std::istream& safeGetline(std::istream& is, std::string& t);

    void read_filename_list(const std::string& filename, std::vector<std::string>& filename_list);

    void read_face_detection(const std::string& filename, std::vector<std::vector<dlib::rectangle>>& detections);
    void read_face_detection(const std::string& filename, std::vector<dlib::rectangle>& detections);
//     int crop_face_from_bbox(const cv::Mat& input, const cv::Rect& bbox, const cv::Size& size, cv::Mat& output);
//
//     struct Identifier
//     {
// 	    Identifier(size_t _file_no, size_t _frame_no) : file_no(_file_no), frame_no(_frame_no)  {};
// 	    size_t  file_no, frame_no;
//     };
//     void read_au_list_from_file(const std::string& filename, std::vector<Identifier>& AU_list);

}


text:
#include <opencv2/videoio.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <dlib/opencv.h>
#include <iostream>

#include "utils.hpp"
#include "detectar_rosto.hpp"
#include "detectar_pontos_faciais_lbf.hpp"
#include "detectar_pontos_faciais_sp.hpp"

dlib::frontal_face_detector faceDetectorDlib;
dlib::shape_predictor facemarkDlib;
cv::Ptr<cv::CascadeClassifier> faceDetectorOpenCV;
cv::Ptr<cv::face::Facemark> facemarkOpenCV;

bool detectarRostosComDlib;
bool detectarPontosComDlib;

std::string tipo;

void coletarPontosFaciais(cv::Mat img);

int main()
{
    //Coleta informações da GPU
    //cv::cuda::printCudaDeviceInfo(0);
    //std::cout << "cuda:" << cv::cuda::getCudaEnabledDeviceCount() << std::endl;

    std::cout << "Detector Facial: Informe o tipo de detector de rostos que você deseja testar:" << std::endl
              << " 1: OpenCV - Haarscascade" << std::endl
              << " 2: Dlib - HoG Face Detector" << std::endl;
    std::cin >> tipo;
    //Inicia marcados de pontos faciais
    if (tipo.compare("1") == 0)
        detectarRostosComDlib = false; //Opencv LBF
    else if (tipo.compare("2") == 0)
        detectarRostosComDlib = true; //DLIB - Shape Predict
    else
    {
        std::cout << "Nenhum tipo informado." << std::endl;
        return 1;
    }

    std::cout << "Detector Pontos Faciais: Informe o tipo de detector por pontos faciais que você deseja testar:" << std::endl
              << " 1: OpenCV - LBF" << std::endl
              << " 2: Dlib - Shape Predict" << std::endl;
    std::cin >> tipo;
    //Inicia marcados de pontos faciais
    if (tipo.compare("1") == 0)
        detectarPontosComDlib = false; //Opencv LBF
    else if (tipo.compare("2") == 0)
        detectarPontosComDlib = true; //DLIB - Shape Predict
    else
    {
        std::cout << "Nenhum tipo informado." << std::endl;
        return 1;
    }

    //Inicia detector facial e de olhos por Haarcascade
    if (detectarRostosComDlib)
        faceDetectorDlib = dlib::get_frontal_face_detector();
    else
        faceDetectorOpenCV = iniciarDetectorFacial();

    if (detectarPontosComDlib)
        //Carrega o modelo treinado do dlib shape predictor
        iniciarDetectorPontosFacialSP(facemarkDlib);
    else
        //Carrega o modelo treinado para o opencv lbf
        facemarkOpenCV = iniciarDetectorPontosFacialLBF();

    //Inicia captura dos vídeos
    cv::VideoCapture cap(2);
    //cap.set(cv::CAP_PROP_FPS, 10);

    if (!cap.isOpened())
    {
        std::cout << "Video Capture Fail" << std::endl;
        return 1;
    }
    cv::Mat img;
    cap >> img;

    //Calcula nova dimensão da imagem para 480 pixels
    auto showSize = cv::Size(640, ((float)640 / img.cols) * img.rows);

    for (;;)
    {
        //Coleta a imagem da camera
        cap >> img;

        //Reescala a imagem para uma largura de 320 pixels
        cv::resize(img, img, showSize);

        coletarPontosFaciais(img);
        cv::imshow("Origem", img);

        cv::waitKey(5);
    }
}

dlib::array2d<dlib::rgb_pixel> imagemOriginalDlib;
cv::Mat imagemOriginalCinza;
const auto liminarOlhoFechado = 0.24;
const auto liminarOlhoAberto = 0.26;
bool olhoEsquerdoAberto = false, olhoDireitoAberto = false, pontosDetectados = false;
int piscadas = 0;

void coletarPontosFaciais(cv::Mat imagemOriginal)
{
    std::vector<cv::Rect> rostosDetectados;
    olhoDimencoes olhoEsquerdoDimencoes, olhoDireitoDimencoes;
    std::vector<std::vector<cv::Point2f>> pontosFaciais;
    cv::Mat imagemComPontosFaciais;

    if (detectarRostosComDlib || detectarPontosComDlib)
    {
        //Converte a imagem do opencv na dlib
        dlib::assign_image(imagemOriginalDlib, dlib::cv_image<dlib::bgr_pixel>(imagemOriginal));
    }

    {
        //Converte em tons de cinza e equaliza a imagem
        //Detecção por haarcascade funcionam bem com imagens equalizadas
        cvtColor(imagemOriginal, imagemOriginalCinza, cv::COLOR_BGR2GRAY);
        equalizeHist(imagemOriginalCinza, imagemOriginalCinza);

        //Detecta os rostos na imagem
        if (detectarRostosComDlib)
        {
            dlibHOGDetectMultiScale(faceDetectorDlib, imagemOriginalDlib, rostosDetectados);
        }
        else
        {
            faceDetectorOpenCV->detectMultiScale(imagemOriginal, rostosDetectados);
        }
    }

    imagemComPontosFaciais = imagemOriginal.clone();
    if (rostosDetectados.size() != 0)
    {

        //Demarca rosto na imagem original
        for (auto &&rostoDetec : rostosDetectados)
        {
            demarcarRostoDetectado(imagemOriginal, rostoDetec);
        }

        //Detecta os pontos faciais
        if (detectarPontosComDlib)
        {
            pontosDetectados = shapePradictorDetectMultiScale(facemarkDlib, imagemOriginalDlib, rostosDetectados, pontosFaciais);
        }
        else
        {
            pontosDetectados = facemarkOpenCV->fit(imagemOriginal, rostosDetectados, pontosFaciais);
        }

        if (pontosDetectados)
        {
            demarcarPontosFaciais(imagemComPontosFaciais, rostosDetectados, pontosFaciais);

            for (unsigned long i = 0; i < rostosDetectados.size(); i++)
            {
                //Coleta as dimensões(largura, altura e proporção) dos olhos
                std::tie(olhoEsquerdoDimencoes, olhoDireitoDimencoes) = coletarDimensoesOlhos(pontosFaciais[i]);
                escreverDimensoesOlhos(imagemOriginal, rostosDetectados[i], olhoEsquerdoDimencoes, olhoDireitoDimencoes);

                //Olho direito esta aberto?
                if (olhoEsquerdoDimencoes.proporcao > liminarOlhoAberto)
                {
                    //Registra que olho esta aberto
                    olhoEsquerdoAberto = true;
                }
                else if (olhoEsquerdoDimencoes.proporcao < liminarOlhoFechado)
                {
                    //Verifica se último registro é de olho aberto
                    if (olhoEsquerdoAberto)
                    {
                        //Se for contabiliza piscada
                        piscadas++;
                    }
                    olhoEsquerdoAberto = false;
                }

                //Olho direito esta aberto?
                if (olhoDireitoDimencoes.proporcao > liminarOlhoFechado)
                {
                    //Registra que olho esta aberto
                    olhoDireitoAberto = true;
                }
                else
                {
                    //Verifica se último registro é de olho aberto
                    if (olhoDireitoAberto)
                    {
                        //Se for contabiliza piscada
                        piscadas++;
                    }
                    olhoDireitoAberto = false;
                }
            }
        }
    }
    imshow("Pontos faciais", imagemComPontosFaciais);
    escreverQtdPiscadas(imagemOriginal, piscadas);
}


text:
/**
*  @file
*  @copyright defined in xmax/LICENSE
*/
#pragma once

#include <apps.hpp>
#include <app_types.hpp>
#include <unordered_map>
#include <boost/preprocessor/variadic/to_list.hpp>
#include <boost/preprocessor/list/for_each.hpp>

namespace xmaxapp
{
	class PluginFace;
	class PluginFactory;

	using PluginFactoryFunction = PluginFace* (ApplicationBase*);
	using PluginInitOptions = void (OptionsDesc& cli, OptionsDesc& cfg);
	using DependentPluginVistior = std::function<void(const std::string& plugin_name)>;

	/**
	*  plugin factory.
	*/
	class PluginFactory
	{
	public:
	    /**
		 *create a plugin
		 * @param[in] ApplicationBase
		 */
		PluginFace* CreatePlugin(ApplicationBase* owner);
		/**
		 *name of plugin
		 */
		const string& GetName() const;
		/**
		* initialize options
		* @param[in] OptionsDesc program options which passed by program command line arguments
		* @param[in] OptionsDesc configuration options which set in configuration file and also supported passing by program command line arguments
		*/
		void InitOptions(OptionsDesc& cli, OptionsDesc& cfg);

		/**
		* Visit dependent plugin recursively
		* @param[in] DependentPluginVistior visitor function
		*/
		void VisitDependentPluginsRecursively(DependentPluginVistior visitor);

		/**
		* register a plugin's dependent plugins.
		* @param[in] string				dependent plugin vector
		*/
		bool RegistPluginDependencies(std::vector<string> dependent_plugins);

		/**
		* return if this factory is created
		* @param[in] string name of plugin
		*/
		static bool IsRegist(const string& name);
		/**
		* get factory
		* @param[in] string name of plugin
		*/
		static PluginFactory* GetPluginFactory(const string& name);
		/**
		* create a plugin
		* @param[in] string				name of plugin
		* @param[in] ApplicationBase
		*/
		static PluginFace* NewPlugin(const string& name, ApplicationBase* owner);
		/**
		* register a factory
		* @param[in] string				name of plugin
		* @param[in] std::function		factory method
		* @param[in] std::function		init options
		*/
		static bool RegistFactory(const string& _name, const std::function<PluginFactoryFunction>& _function, const std::function<PluginInitOptions>& _function2);

	private:
		/**
		* constructor
		* @param[in] string name of plugin
		* @param[in] std::function factory method
		* @param[in] std::function initoptions
		*/
		PluginFactory(const string& _name, const std::function<PluginFactoryFunction>& _function, const std::function<PluginInitOptions>& _function2);

	protected:
		static std::unordered_map<string, std::unique_ptr<PluginFactory>> sPluginFactorys;

	private:
		string plugin_name_;
		std::function<PluginFactoryFunction> create_function_;
		std::function<PluginInitOptions> init_options_;
		std::vector<std::string> dependent_plugins_;

	};

	class PluginFace : public Plugin
	{
		//GENERATED_PLUGIN(plugin_face, plugin);
	public:
		/**
		* return the state of plugin
		*/
		virtual State GetState() const override;

		virtual ApplicationBase* GetApp() const override;
		/**
		* set state of the plugin
		* @param[in] options::variables_map		param map
		*/
		virtual void Initialize(const VarsMap& options);
		/**
		* start a plugin
		*/
		virtual void Startup();
		/**
		* stutdown a plugin
		*/
		virtual void Shutdown();
		/**
		* return the name of plugin
		*/
		virtual const string& GetName() const = 0;

		friend class PluginFactory;

	protected:
		PluginFace();

		virtual void OnCreated();

		template<typename TPlugin>
		static TPlugin* CreatePluginImpl(ApplicationBase* _owner)
		{
			TPlugin* _self = new TPlugin();
			_self->SetOwner(_owner);
			return _self;
		}

		static void RegistPluginDependencies() {}

	private:
		void SetOwner(ApplicationBase* _owner)
		{
			plugin_owner_ = _owner;
		}
		Plugin::State plugin_state_;
		ApplicationBase* plugin_owner_;
	};

}

/**
* this macro help you generate code of a concrete plugin
*/

#define MACRO_TO_QUOTE(r, data, elem) #elem,

#define GENERATED_PLUGIN(plugin_self, super_class, init_opt) \
	public:\
		typedef super_class Super;\
		static const xmaxapp::string& PluginName()\
		{	\
			static const xmaxapp::string _plugin_name(#plugin_self);\
			return _plugin_name;\
		}	\
		static bool RegistSelf()\
		{\
			bool ret = xmaxapp::PluginFactory::RegistFactory(PluginName(), createPlugin, init_opt);\
			RegistPluginDependencies();\
			return ret;\
		}\
		virtual const xmaxapp::string& GetName() const override\
		{\
			return PluginName();\
		}\
	private:\
		static xmaxapp::PluginFace* createPlugin(xmaxapp::ApplicationBase* _owner)\
		{\
			return CreatePluginImpl<plugin_self>(_owner);\
		}

#define PLUGIN_DEPENDS(...) \
	protected:\
		static void RegistPluginDependencies() { \
			xmaxapp::PluginFactory::GetPluginFactory(PluginName())->RegistPluginDependencies( \
				{ BOOST_PP_LIST_FOR_EACH(MACRO_TO_QUOTE, _, BOOST_PP_VARIADIC_TO_LIST(__VA_ARGS__)) }); \
		}

//#define ALWAYS_REGIST_PLUGIN(plugin_self) \
//static bool b##plugin_self##_xxx = plugin_self::RegistSelf();

max_stars_repo_name: xleakOfficial/xmax-mainchain

max_issues_repo_name: xleakOfficial/xmax-mainchain

max_forks_repo_name: xleakOfficial/xmax-mainchain


text:
/*
 * This is a small tutorial code example...
 *
 * Author: Damir Cavar
 * Date: 07/15/2015, 09/05/2016
 * Purpose:
 *
 * Extract segments of transcription and corresponding audio sequence from ELAN annotated audio files.
 *
 * The extractor uses the first tier of annotation for the segmentation, otherwise the tier name can be
 * provided using the -t parameter.
 *
 *
 * (C) 2015-2016 by Damir Cavar <dcavar@iu.edu>
 *
 * 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.
 *
 */

#include <iostream>
#include <fstream>
#include <vector>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include "MySAX2Handler.h"
#include "MyMiniSAX2Handler.h"
#include "MyMediaSAX2Handler.h"

using namespace std;

namespace {
    const size_t ERROR_IN_COMMAND_LINE = 1;
    const size_t SUCCESS = 0;
    const size_t ERROR_XML = 2;
    const size_t ERROR_UNHANDLED_EXCEPTION = 3;
    const size_t ERROR_MISSING_FILE = 4;
} // namespace

using namespace xercesc;
namespace fs = boost::filesystem;
namespace po = boost::program_options;

int getMediaNames(string xmlFile) {
    if (xmlFile.substr(xmlFile.find_last_of(".") + 1) != "eaf") {
        cout << "Warning: File " << xmlFile << " does not have the expected .eaf ending." << endl;
        cout << "Trying to parse as ELAN Annotation File (XML)." << endl;
    }
    cout << "Media files in ELAN Annotation File: " << xmlFile << ":" << endl;

    SAX2XMLReader *parser = XMLReaderFactory::createXMLReader();
    parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); // optional

    MyMediaSAX2Handler *handler = new MyMediaSAX2Handler();
    parser->setContentHandler(handler);
    parser->setErrorHandler(handler);
    fs::path p(xmlFile);
    handler->file_path = p.parent_path().string();

    try {
        parser->parse((char *) xmlFile.c_str());
    }
    catch (const XMLException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const SAXParseException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const std::invalid_argument &e) {
        cerr << "Exception message is:" << endl << e.what() << endl;
        return ERROR_MISSING_FILE;
    }
    catch (...) {
        cerr << "Unexpected Exception" << endl;
        return ERROR_UNHANDLED_EXCEPTION;
    }

    delete parser;
    delete handler;
    return SUCCESS;
}

int getTierLabels(string xmlFile) {
    if (xmlFile.substr(xmlFile.find_last_of(".") + 1) != "eaf") {
        cout << "Warning: File " << xmlFile << " does not have the expected .eaf ending." << endl;
        cout << "Trying to parse as ELAN Annotation File (XML)." << endl;
    }
    cout << "Tiers in ELAN Annotation File: " << xmlFile << ":" << endl;

    SAX2XMLReader *parser = XMLReaderFactory::createXMLReader();
    parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); // optional

    MyMiniSAX2Handler *handler = new MyMiniSAX2Handler();
    parser->setContentHandler(handler);
    parser->setErrorHandler(handler);
    fs::path p(xmlFile);
    handler->file_path = p.parent_path().string();

    try {
        parser->parse((char *) xmlFile.c_str());
    }
    catch (const XMLException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const SAXParseException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const std::invalid_argument &e) {
        cerr << "Exception message is:" << endl << e.what() << endl;
        return ERROR_MISSING_FILE;
    }
    catch (...) {
        cerr << "Unexpected Exception" << endl;
        return ERROR_UNHANDLED_EXCEPTION;
    }

    delete parser;
    delete handler;
    return SUCCESS;
} // getTierLabels

int parseXML(string xmlFile, string tier_name, string output_folder, string text_suffix, bool quiet,
             bool force_overwrite,
             bool add_tier_name) {
    if (xmlFile.substr(xmlFile.find_last_of(".") + 1) != "eaf") {
        if (!quiet) {
            cout << "Warning: File " << xmlFile << " does not have the expected .eaf ending." << endl;
            cout << "Trying to parse as ELAN Annotation File (XML)." << endl;
        }
    }
    if (!quiet)
        cout << "Parsing ELAN Annotation File: " << endl << xmlFile << endl;

    SAX2XMLReader *parser = XMLReaderFactory::createXMLReader();
    parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); // optional

    MySAX2Handler *handler = new MySAX2Handler();
    handler->quiet = quiet; // -q from command line
    handler->target_tier_name = tier_name; // -t from command line
    handler->force_overwrite = force_overwrite; // -f from command line
    parser->setContentHandler(handler);
    parser->setErrorHandler(handler);
    fs::path p(xmlFile);
    handler->file_path = p.parent_path().string();
    handler->output_folder = output_folder;
    handler->add_tier_name = add_tier_name;
    if (text_suffix.size() > 0) {
        handler->text_suffix = text_suffix;
    }

    if (!quiet)
        cout << "Setting file path to:" << endl << handler->file_path << endl;

    try {
        parser->parse((char *) xmlFile.c_str());
        if (!handler->tier_selected) {
            if (handler->target_tier_name.size() > 0)
                cerr << "Could not find tier " << handler->target_tier_name << endl;
            else
                cerr << "No tier for segmentation found!" << endl;
            throw invalid_argument("Tier for segmentation not found.");
        }
    }
    catch (const XMLException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const SAXParseException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        return ERROR_XML;
    }
    catch (const std::invalid_argument &e) {
        cerr << "Exception message is:" << endl << e.what() << endl;
        return ERROR_MISSING_FILE;
    }
    catch (...) {
        cerr << "Unexpected Exception" << endl;
        return ERROR_UNHANDLED_EXCEPTION;
    }
    delete parser;
    delete handler;
    return SUCCESS;
} // parseXML

void help() {
    cout << "Usage: elan2split [OPTION]... [FILE]..." << endl
         << "For help: elan2split --help" << endl << endl
         << "Split ELAN Annotation files and audio recordings into single file pairs for" << endl
         << "each annotation segment at a specific tier, or using the first annotation" << endl
         << "tier in the ELAN .eaf file." << endl << endl
         << "(C) 2015-2016 by Damir Cavar <dcavar@iu.edu>" << endl << endl;
}

int main(int argc, char *argv[]) {
    bool quiet = false;
    bool list_only = false;
    bool media_only = false;
    bool force_overwrite = false;
    bool add_tier_name = false;
    string tier_name;
    string output_folder;
    string text_suffix = "";

    try {
        XMLPlatformUtils::Initialize();
    }
    catch (const XMLException &toCatch) {
        char *message = XMLString::transcode(toCatch.getMessage());
        cerr << "Error during initialization!" << endl;
        cerr << "Exception message is:" << endl << message << endl;
        XMLString::release(&message);
        help();
        return ERROR_XML;
    }

    try {
        po::options_description desc("elan2split options");
        desc.add_options()
                ("force,f", "Force overwrite output files")
                ("help,h",  "Print help messages")
                ("quiet,q", "Quiet operations")
                ("list,l",  "List all tiers in the ELAN Annotation File")
                ("media,m", "List all attached media files (the first one is chosen for segmentation)")
                ("name,n",  "Add tier name to text-filename")
                ("suffix,s",       po::value<string>(), "Suffix for text-file")
                ("tier,t",         po::value<string>(), "Name of tier to segment")
                ("outputfolder,o", po::value<string>(), "Path of output folder (will be created, if it does not exist)")
                ("elan-files",     po::value<vector<string>>()->required(), "ELAN input files");

        po::positional_options_description p;
        p.add("elan-files", -1);
        po::variables_map vm;
        po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);

        if (vm.count("help")) {
            help();
            XMLPlatformUtils::Terminate();
            return SUCCESS;
        }
        po::notify(vm);

        if (vm.count("force")) {
            force_overwrite = true;
        }
        if (vm.count("quiet")) {
            quiet = true;
        }
        if (vm.count("tier")) {
            tier_name = vm["tier"].as<string>();
            if (!quiet)
                cout << "Processing tier: " << tier_name << endl;
        }
        if (vm.count("suffix")) {
            text_suffix = vm["suffix"].as<string>();
            if (!quiet)
                cout << "Using suffix for text-files: " << text_suffix << endl;
        }
        if (vm.count("name")) {
            add_tier_name = true;
        }
        if (vm.count("list")) {
            list_only = true;
            cout << "Available tiers: " << endl;
        }
        if (vm.count("media")) {
            media_only = true;
            cout << "Available media files: " << endl;
        }
        if (vm.count("outputfolder")) { // determine output folder
            fs::path of = fs::path(vm["outputfolder"].as<string>());
            if (!fs::exists(of)) { // create folders, if they do not exist
                fs::create_directories(of);
            } else if (fs::is_regular_file(of)) {
                cerr << "The specified output folder is an existing file." << endl
                << "Please specify an existing or new folder for the output." << endl;
                throw invalid_argument("Invalid output folder option.");
            }
            output_folder = fs::canonical(of).string();
            if (!quiet)
                cout << "Output folder: " << output_folder << endl;
        } else { // default output folder is getcwd
            output_folder = fs::canonical(fs::current_path()).string();
            if (!quiet)
                cout << "Output folder: " << output_folder << endl;
        }
        if (vm.count("elan-files")) {
            vector<string> files = vm["elan-files"].as<vector<string>>();
            for (string file : files) {
                if (list_only)
                    getTierLabels(fs::canonical(file).string());
                if (media_only)
                    getMediaNames(fs::canonical(file).string());
                if (!list_only && !media_only)
                    parseXML(fs::canonical(file).string(), tier_name, output_folder, text_suffix, quiet,
                             force_overwrite,
                             add_tier_name);
            }
        }
    }
    catch (std::exception &e) {
        cerr << "Error: " << e.what() << endl;
        XMLPlatformUtils::Terminate();
        help();
        return ERROR_IN_COMMAND_LINE;
    }
    catch (...) {
        cerr << "Unknown error!" << endl;
        XMLPlatformUtils::Terminate();
        help();
        return ERROR_UNHANDLED_EXCEPTION;
    }
    XMLPlatformUtils::Terminate();
    return SUCCESS;
} // main


text:
/*
* Software License Agreement (BSD License)
*
*  Copyright (c) 2013-2015, Timm Linder, Social Robotics Lab, University of Freiburg
*  All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without
*  modification, are permitted provided that the following conditions are met:
*
*  * Redistributions of source code must retain the above copyright notice, this
*    list of conditions and the following disclaimer.
*  * Redistributions in binary form must reproduce the above copyright notice,
*    this list of conditions and the following disclaimer in the documentation
*    and/or other materials provided with the distribution.
*  * Neither the name of the copyright holder nor the names of its contributors
*    may be used to endorse or promote products derived from this software
*    without specific prior written permission.
*
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
*  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
*  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
*  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
*  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
*  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
*  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef TRACKED_GROUPS_DISPLAY_H
#define TRACKED_GROUPS_DISPLAY_H

#ifndef Q_MOC_RUN
#include <map>
#include <boost/circular_buffer.hpp>
#endif
#include <spencer_tracking_msgs/TrackedGroups.h>

#include "person_display_common.h"
#include "tracked_persons_cache.h"

namespace spencer_tracking_rviz_plugin
{
    typedef unsigned int group_id;

    /// A single entry in the history of a tracked person, to show group affiliation.
    struct GroupAffiliationHistoryEntry
    {
        group_id groupId;
        boost::shared_ptr<rviz::Shape> shape;
        bool wasOccluded, wasSinglePersonGroup;
    };

    /// History of a tracked person.
    typedef circular_buffer<boost::shared_ptr<GroupAffiliationHistoryEntry> > GroupAffiliationHistory;

    /// The display which can be added in RViz to display tracked groups.
    class TrackedGroupsDisplay: public PersonDisplayCommon<spencer_tracking_msgs::TrackedGroups>
    {
    Q_OBJECT
    public:
        // Constructor.  pluginlib::ClassLoader creates instances by calling
        // the default constructor, so make sure you have one.
        TrackedGroupsDisplay() {};
        virtual ~TrackedGroupsDisplay();

        // Overrides of protected virtual functions from Display.  As much
        // as possible, when Displays are not enabled, they should not be
        // subscribed to incoming data and should not show anything in the
        // 3D view.  These functions are where these connections are made
        // and broken.

        // Called after the constructors have run
        virtual void onInitialize();

        // Called periodically by the visualization manager
        virtual void update(float wall_dt, float ros_dt);

    protected:
        // A helper to clear this display back to the initial state.
        virtual void reset();

        // Must be implemented by derived classes because MOC doesn't work in templates
        virtual rviz::DisplayContext* getContext() {
            return context_;
        }

    private:
        struct GroupVisual {
            vector<boost::shared_ptr<rviz::Shape> > groupAssignmentCircles;
            vector<boost::shared_ptr<PersonVisual> > personVisuals;
            vector<boost::shared_ptr<Ogre::SceneNode> > personVisualSceneNodes;
            vector<boost::shared_ptr<rviz::BillboardLine> > connectionLines;
            boost::shared_ptr<TextNode> idText;
            group_id groupId;
            geometry_msgs::Point groupCenter;
            size_t personCount;
        };

        // Functions to handle an incoming ROS message.
        void processMessage(const spencer_tracking_msgs::TrackedGroups::ConstPtr& msg);

        // Helper functions
        void updateGroupVisualStyles(boost::shared_ptr<GroupVisual>& groupVisual);
        void updateHistoryStyles();
        bool isGroupHidden(group_id groupId);

        // Scene node for group affiliation history visualization
        boost::shared_ptr<Ogre::SceneNode> m_groupAffiliationHistorySceneNode, m_groupsSceneNode;

        std::string m_realFixedFrame;

        // User-editable property variables.
        rviz::StringProperty* m_excluded_group_ids_property;
        rviz::StringProperty* m_included_group_ids_property;

        rviz::BoolProperty* m_render_intragroup_connections_property;
        rviz::BoolProperty* m_render_ids_property;
        rviz::BoolProperty* m_render_history_property;
        rviz::BoolProperty* m_single_person_groups_in_constant_color_property;
        rviz::BoolProperty* m_hide_ids_of_single_person_groups_property;

        rviz::IntProperty*   m_history_length_property;

        rviz::FloatProperty* m_occlusion_alpha_property;
        rviz::FloatProperty* m_group_id_offset; // z offset of the group ID text

        // State variables
        vector<boost::shared_ptr<GroupVisual> > m_groupVisuals;

        map<track_id, group_id> m_groupAffiliations;
        GroupAffiliationHistory m_groupAffiliationHistory;
        set<group_id> m_excludedGroupIDs, m_includedGroupIDs;

        Ogre::Matrix4 m_frameTransform;
        TrackedPersonsCache m_trackedPersonsCache;

    private Q_SLOTS:
        void personVisualTypeChanged();
        virtual void stylesChanged();
    };

} // end namespace spencer_tracking_rviz_plugin

#endif // TRACKED_GROUPS_DISPLAY_H


text:
#pragma once
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/ssl.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/error.hpp>
#include <boost/asio/ssl/stream.hpp>
#include "spdlog/spdlog.h"
#include "spdlog/fmt/ostr.h"
#include <string>

namespace beast = boost::beast;   // from <boost/beast.hpp>
namespace http = beast::http;     // from <boost/beast/http.hpp>
namespace net = boost::asio;      // from <boost/asio.hpp>
namespace ssl = net::ssl;         // from <boost/asio/ssl.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
using response = http::response<http::string_body>;
using request = http::request<http::string_body>;

namespace tlg_bot
{
    class HttpClient
    {
    public:
        void send_request_http(const std::string &host, const http::verb &method, const std::string &target);
        void read_response(beast::tcp_stream &stream);

        void send_request_https(const std::string &host, const http::verb &method, const std::string &target);
        void read_response(beast::ssl_stream<beast::tcp_stream> &stream);

    private:
        request create_request(const std::string &host, const http::verb &method, const std::string &target);

        net::io_context m_io_context;
    };
    using PHttp = std::unique_ptr<HttpClient>;
} // namespace tlg_bot


text:
/**
 * @file
 * @copyright This code is licensed under the 3-clause BSD license.\n
 *            Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.\n
 *            See LICENSE.txt for details.
 */
#include "CommandLineOptions.h"
#include <Core/Exceptions.h>
#include <Utils/Settings.h>
#include <Utils/UniversalSettings/SettingsNames.h>
#include <boost/program_options.hpp>
#include <iostream>

namespace Scine {
namespace Sparrow {

namespace {
constexpr const char* helpKey = "help";
constexpr const char* outputToFile = "output_to_file";
constexpr const char* structureKey = "structure";
constexpr const char* methodKey = "method";

constexpr const char* calculateGradients = "gradients";
constexpr const char* calculateHessian = "hessian";
constexpr const char* calculateBondOrders = "bond_orders";
constexpr const char* calculationDescription = "description";
constexpr const char* suppressNormalModesOutput = "suppress_normal_modes";
constexpr const char* wavefunctionOutput = "wavefunction";
constexpr const char* thermochemistry = "thermochemistry";
} // namespace

using namespace boost::program_options;

struct CommandLineOptions::Impl {
  boost::program_options::options_description desc_;
  boost::program_options::variables_map vm_;
  std::string callStatement;
};

CommandLineOptions::CommandLineOptions(int argc, char* argv[]) : pImpl_(std::make_unique<Impl>()) {
  pImpl_->callStatement = generateCallStatement(argc, argv);

  auto helpOption = combineNamesForOptions(helpKey, ",h");
  auto outputToFileOption = combineNamesForOptions(outputToFile, ",o");
  auto chargeOption = combineNamesForOptions(Utils::SettingsNames::molecularCharge, ",c");
  auto multiplicityOption = combineNamesForOptions(Utils::SettingsNames::spinMultiplicity, ",s");
  auto unrestrictedOption = combineNamesForOptions(Utils::SettingsNames::unrestrictedCalculation, ",u");
  auto parameterFileOption = combineNamesForOptions(Utils::SettingsNames::parameterFile, ",p");
  auto parameterRootOption = combineNamesForOptions(Utils::SettingsNames::parameterRootDirectory, ",P");
  auto mixerTypeOption = combineNamesForOptions(Utils::SettingsNames::mixer, ",m");
  auto maxIterationsOption = combineNamesForOptions(Utils::SettingsNames::maxIterations, ",i");
  auto scfThresholdOption = combineNamesForOptions(Utils::SettingsNames::selfConsistanceCriterion, ",t");
  auto methodOption = combineNamesForOptions(methodKey, ",M");
  auto structureOption = combineNamesForOptions(structureKey, ",x");
  auto gradientOption = combineNamesForOptions(calculateGradients, ",G");
  auto hessianOption = combineNamesForOptions(calculateHessian, ",H");
  auto thermochemistryOption = combineNamesForOptions(thermochemistry, ",C");
  auto temperatureOption = combineNamesForOptions(Utils::SettingsNames::temperature, ",T");
  auto suppressNormalModesOption = combineNamesForOptions(suppressNormalModesOutput, ",N");
  auto bondOrdersOption = combineNamesForOptions(calculateBondOrders, ",B");
  auto wavefunctionOption = combineNamesForOptions(wavefunctionOutput, ",W");
  auto descriptionOption = combineNamesForOptions(calculationDescription, ",d");
  auto logOption = combineNamesForOptions(Utils::SettingsNames::loggerVerbosity, ",l");

  // clang-format off
  pImpl_->desc_.add_options()
    (helpOption.c_str(), "prints this help message")
    (outputToFileOption.c_str(), "flag setting the saving of the output matrices as files")
    (chargeOption.c_str(), value<int>(), "sets the molecular charge")
    (multiplicityOption.c_str(), value<int>(), "sets the spin multiplicity")
    (unrestrictedOption.c_str(), "runs unrestricted calculation (UHF)")
    (parameterFileOption.c_str(), value<std::string>(), "sets the desired parameter file")
    (parameterRootOption.c_str(), value<std::string>(), "sets the desired resource directory")
    (mixerTypeOption.c_str(), value<std::string>(), "sets the desired SCF mixer for convergence acceleration")
    (maxIterationsOption.c_str(), value<int>(), "sets the maximum number of SCF iterations")
    (scfThresholdOption.c_str(), value<double>(), "sets the SCF convergence threshold (in hartree)")
    (methodOption.c_str(), value<std::string>(), "sets the method used to perform the calculation")
    (structureOption.c_str(), value<std::string>()->value_name("structure"), "sets the path to the coordinates file")
    (gradientOption.c_str(), "activates the calculation of the atomic gradients")
    (hessianOption.c_str(), "activates the calculation of the molecular Hessian matrix")
    (thermochemistryOption.c_str(), "activates the calculation of thermochemical properties.")
    (temperatureOption.c_str(), value<double>(), "defines the temperature for the thermochemical calculation in Kelvin.")
    (suppressNormalModesOption.c_str(), "suppresses the results of the hessian calculation as normal modes analysis")
    (bondOrdersOption.c_str(), "activates the calculation of the bond order matrix")
    (wavefunctionOption.c_str(), "outputs a molden file for the visualization of orbitals")
    (descriptionOption.c_str(), value<std::string>(), "sets a calculation description which will appear in the output")
    (logOption.c_str(), value<std::string>()->default_value("warning"), "sets whether warnings and errors are printed");

  // clang-format on

  // Set options without name to be structures
  positional_options_description p;
  p.add(structureOption.c_str(), -1);

  store(command_line_parser(argc, argv).options(pImpl_->desc_).positional(p).run(), pImpl_->vm_);
  notify(pImpl_->vm_);
}

CommandLineOptions::~CommandLineOptions() = default;

std::string CommandLineOptions::getCallStatement() const {
  return pImpl_->callStatement;
}

bool CommandLineOptions::helpRequired() const {
  return pImpl_->vm_.count(helpKey) > 0;
}

bool CommandLineOptions::outputToFileRequired() const {
  return pImpl_->vm_.count(outputToFile) > 0;
}

std::string CommandLineOptions::getSelectedMethodName() const {
  if (pImpl_->vm_.count(methodKey) > 0) {
    std::string result = pImpl_->vm_[methodKey].as<std::string>();
    for (auto& c : result)
      c = static_cast<char>(std::toupper(c));
    return result;
  }
  return "PM6";
}

std::string CommandLineOptions::getCalculationDescription() const {
  if (pImpl_->vm_.count(calculationDescription) > 0) {
    return pImpl_->vm_[calculationDescription].as<std::string>();
  }
  return "";
}

std::string CommandLineOptions::getLoggerVerbosity() const {
  return pImpl_->vm_[Utils::SettingsNames::loggerVerbosity].as<std::string>();
}

bool CommandLineOptions::gradientRequired() const {
  return pImpl_->vm_.count(calculateGradients) > 0;
}

bool CommandLineOptions::hessianRequired() const {
  return pImpl_->vm_.count(calculateHessian) > 0;
}

bool CommandLineOptions::bondOrdersRequired() const {
  return pImpl_->vm_.count(calculateBondOrders) > 0;
}

bool CommandLineOptions::suppressNormalModes() const {
  return pImpl_->vm_.count(suppressNormalModesOutput) > 0;
}

bool CommandLineOptions::wavefunctionRequired() const {
  return pImpl_->vm_.count(wavefunctionOutput) > 0;
}

bool CommandLineOptions::thermochemistryRequired() const {
  return pImpl_->vm_.count(thermochemistry) > 0;
}

template<class CharPtrType, class StringType>
std::string CommandLineOptions::combineNamesForOptions(CharPtrType nameOfOption, StringType abbreviatedOption) const {
  auto combinedString = static_cast<std::string>(nameOfOption) + static_cast<std::string>(abbreviatedOption);
  return combinedString;
}

void CommandLineOptions::updateSettings(Utils::Settings& settingsToUpdate) const {
  using namespace Utils::SettingsNames;
  if (validOptionToSet(molecularCharge, settingsToUpdate)) {
    settingsToUpdate.modifyInt(molecularCharge, pImpl_->vm_[molecularCharge].as<int>());
  }
  if (validOptionToSet(spinMultiplicity, settingsToUpdate)) {
    settingsToUpdate.modifyInt(spinMultiplicity, pImpl_->vm_[spinMultiplicity].as<int>());
  }
  if (validOptionToSet(unrestrictedCalculation, settingsToUpdate)) {
    settingsToUpdate.modifyBool(unrestrictedCalculation, true);
  }
  if (validOptionToSet(mixer, settingsToUpdate)) {
    settingsToUpdate.modifyString(mixer, pImpl_->vm_[mixer].as<std::string>());
  }
  if (validOptionToSet(maxIterations, settingsToUpdate)) {
    settingsToUpdate.modifyInt(maxIterations, pImpl_->vm_[maxIterations].as<int>());
  }
  if (validOptionToSet(selfConsistanceCriterion, settingsToUpdate)) {
    settingsToUpdate.modifyDouble(selfConsistanceCriterion, pImpl_->vm_[selfConsistanceCriterion].as<double>());
  }
  if (validOptionToSet(parameterFile, settingsToUpdate)) {
    settingsToUpdate.modifyString(parameterFile, pImpl_->vm_[parameterFile].as<std::string>());
  }
  if (validOptionToSet(parameterRootDirectory, settingsToUpdate)) {
    settingsToUpdate.modifyString(parameterRootDirectory, pImpl_->vm_[parameterRootDirectory].as<std::string>());
  }
  if (validOptionToSet(temperature, settingsToUpdate)) {
    settingsToUpdate.modifyDouble(temperature, pImpl_->vm_[temperature].as<double>());
  }
}

template<class CharType>
bool CommandLineOptions::validOptionToSet(CharType optionIdentifier, const Utils::Settings& settings) const {
  return pImpl_->vm_.count(optionIdentifier) && settings.valueExists(optionIdentifier);
}

void CommandLineOptions::printHelp(std::ostream& out) const {
  out << "Usage: <executable> [options]\n";
  out << pImpl_->desc_;
}

std::string CommandLineOptions::getStructureCoordinatesFile() const {
  if (pImpl_->vm_.count(structureKey) > 0) {
    return pImpl_->vm_[structureKey].as<std::string>();
  }
  throw Core::InitializationException("No coordinate file given.");
}

std::string CommandLineOptions::generateCallStatement(int argc, char* argv[]) const {
  std::string callStatement = "";
  for (int i = 0; i < argc; ++i) {
    callStatement += " " + std::string(argv[i]);
  }
  return callStatement;
}

} // namespace Sparrow
} // namespace Scine

max_stars_repo_name: DockBio/sparrow

max_issues_repo_name: DockBio/sparrow

max_forks_repo_name: DockBio/sparrow


text:
/// \file   timing.hpp
///
/// \brief
///
/// \authors    Maarten P. Scholl
/// \date       2018-11-23
/// \copyright  Copyright 2017-2019 The Institute for New Economic Thinking,
///             Oxford Martin School, University of Oxford
///
///             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.
///
///             You may obtain instructions to fulfill the attribution
///             requirements in CITATION.cff
///
#ifndef ESL_COMPUTATION_TIMING_HPP
#define ESL_COMPUTATION_TIMING_HPP

#include <chrono>

#include <boost/serialization/binary_object.hpp>
#include <boost/serialization/nvp.hpp>

namespace esl::computation {

    ///
    /// \brief  Tests if the provided clock has at least millisecond precision
    ///
    /// \details    This integer fraction tells us the precision in seconds,
    ///             therefore we test the reciprocal.
    ///
    static_assert(std::chrono::high_resolution_clock::period::den
                      / std::chrono::high_resolution_clock::period::num
                  >= 1000);

    ///
    ///
    ///
    struct agent_timing
    {
        std::chrono::milliseconds messaging;
        std::chrono::milliseconds acting;

        template<class archive_t>
        void serialize(archive_t &archive, const unsigned int version)
        {
            (void)version;

            boost::serialization::make_nvp(
                "messaging",
                boost::serialization::make_binary_object(&messaging,
                                                         sizeof(messaging)));

            boost::serialization::make_nvp(
                "acting",
                boost::serialization::make_binary_object(&acting,
                                                         sizeof(acting)));
        }
    };
}  // namespace esl::computation

#ifdef WITH_MPI
#include <boost/mpi.hpp>

namespace boost::mpi {
    ///
    /// \details    POD structures can be mapped to MPI datatypes therefore
    ///             this derives true_
    template<>
    struct is_mpi_datatype<esl::computation::agent_timing>
        : public mpl::true_
    {};
}  // namespace boost::mpi
#endif  // WITH_MPI

#endif  // ESL_COMPUTATION_TIMING_HPP


text:
#ifndef MPLLIBS_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP
#define MPLLIBS_METAPARSE_V1_IMPL_ITERATE_IMPL_UNCHECKED_HPP

// Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
// 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)

#include <mpllibs/metaparse/v1/impl/fwd/iterate_impl.hpp>
#include <mpllibs/metaparse/v1/get_result.hpp>
#include <mpllibs/metaparse/v1/get_remaining.hpp>
#include <mpllibs/metaparse/v1/get_position.hpp>

#include <boost/mpl/apply.hpp>
#include <boost/mpl/apply_wrap.hpp>
#include <boost/mpl/push_back.hpp>

namespace mpllibs
{
  namespace metaparse
  {
    namespace v1
    {
      namespace impl
      {
        template <int N, class P, class Accum, class S, class Pos>
        struct iterate_impl_unchecked :
          boost::mpl::apply_wrap2<
            iterate_impl<
              N - 1,
              P,
              typename boost::mpl::push_back<
                Accum,
                typename get_result<boost::mpl::apply<P, S, Pos> >::type
              >::type
            >,
            typename get_remaining<boost::mpl::apply<P, S, Pos> >::type,
            typename get_position<boost::mpl::apply<P, S, Pos> >::type
          >
        {};
      }
    }
  }
}

#endif


text:
//  Copyright (c) 2012 Thomas Heller
//
//  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)

#include <hpx/hpx_fwd.hpp>
#include <hpx/async.hpp>
#include <hpx/lcos/local/packaged_continuation.hpp>

#include "stencil_iterator.hpp"

#include <boost/make_shared.hpp>

namespace jacobi
{
    namespace server
    {
        void stencil_iterator::step()
        {

            jacobi::row top = top_future[src].get();
            jacobi::row bottom = bottom_future[src].get();

            HPX_ASSERT(top.id);
            HPX_ASSERT(bottom.id);
            HPX_ASSERT(top.id != bottom.id);
            HPX_ASSERT(this->get_gid() != top.id);
            HPX_ASSERT(this->get_gid() != bottom.id);

            std::vector<hpx::lcos::future<void> > fs;
            for(std::size_t x = 1; x < nx-1; x += line_block)
            {
                std::size_t x_end = (std::min)(nx-1, x + line_block);
                fs.push_back(
                    hpx::async(
                        &stencil_iterator::update
                      , this
                      , rows[dst].get(x, x_end)
                      , rows[src].get(x-1, x_end+1)
                      , top.get(x, x_end)
                      , bottom.get(x, x_end)
                    )
                );
            }
            hpx::wait_all(fs);
            std::swap(src, dst);
        }

        void stencil_iterator::update(
            hpx::lcos::future<row_range> dst
          , hpx::lcos::future<row_range> src
          , hpx::lcos::future<row_range> top
          , hpx::lcos::future<row_range> bottom
        )
        {
            row_range d = dst.get();

            std::vector<double>::iterator dst_ptr = d.begin();
            row_range s = src.get();
            std::vector<double>::iterator src_ptr = s.begin();
            row_range t = top.get();
            std::vector<double>::iterator top_ptr = t.begin();
            row_range b = bottom.get();
            std::vector<double>::iterator bottom_ptr = b.begin();

            HPX_ASSERT(
                d.end() - d.begin() + 2 == s.end() - s.begin()
            );
            HPX_ASSERT(
                d.end() - d.begin() == t.end() - t.begin()
            );
            HPX_ASSERT(
                d.end() - d.begin() == b.end() - b.begin()
            );

            ++src_ptr;
            while(dst_ptr < d.end())
            {
                HPX_ASSERT(dst_ptr < d.end());
                HPX_ASSERT(src_ptr < s.end());
                HPX_ASSERT(top_ptr < t.end());
                HPX_ASSERT(bottom_ptr < b.end());
                *dst_ptr
                    =(
                        *(src_ptr - 1) + *(src_ptr + 1)
                      + *top_ptr + *bottom_ptr
                    ) * 0.25;
                ++dst_ptr;
                ++src_ptr;
                ++top_ptr;
                ++bottom_ptr;
            }
        }

        jacobi::row stencil_iterator::get(std::size_t idx)
        {
            HPX_ASSERT(rows[idx].id);
            return rows[idx];
        }
    }
}

typedef hpx::components::managed_component<
    jacobi::server::stencil_iterator
> stencil_iterator_type;

HPX_REGISTER_COMPONENT(stencil_iterator_type, stencil_iterator);

HPX_REGISTER_ACTION(
    jacobi::server::stencil_iterator::init_action
  , jacobi_server_stencil_iterator_init_action
)

HPX_REGISTER_ACTION(
    jacobi::server::stencil_iterator::setup_boundary_action
  , jacobi_server_stencil_iterator_setup_boundary_action
)

HPX_REGISTER_ACTION(
    jacobi::server::stencil_iterator::step_action
  , jacobi_server_stencil_iterator_step_action
)

HPX_REGISTER_ACTION(
    jacobi::server::stencil_iterator::get_action
  , jacobi_server_stencil_iterator_get_action
)

max_stars_repo_name: akemp/hpx

max_issues_repo_name: akemp/hpx

max_forks_repo_name: akemp/hpx


text:
#include <jni.h>

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <Eigen/Geometry>

#include "point_cloud/include/PointCloudTransform.h"

extern "C"
{
	JNIEXPORT void JNICALL Java_it_unibo_slam_gui_opengl_model_PointCloudStatic_reprojectPointCloudVertices(JNIEnv *env, jobject obj,
			jfloatArray transform, jint pointArrayLength, jfloatArray pointsInOut);
}

JNIEXPORT void JNICALL Java_it_unibo_slam_gui_opengl_model_PointCloudStatic_reprojectPointCloudVertices(JNIEnv *env, jobject obj,
		jfloatArray transform, jint pointArrayLength, jfloatArray pointsInOut)
{
	float tempTransform[16];
	env->GetFloatArrayRegion(transform, 0, 16, tempTransform);
	Eigen::Matrix4f transformEigen(Eigen::Matrix4f::Map(tempTransform));

	float *tempPointsInOut = env->GetFloatArrayElements(pointsInOut, NULL);

	reprojectPointCloud(tempPointsInOut, tempPointsInOut, pointArrayLength, transformEigen);

	env->ReleaseFloatArrayElements(pointsInOut, tempPointsInOut, 0);
}

max_stars_repo_name: CVLAB-Unibo/Slam-Dunk-Android

max_issues_repo_name: CVLAB-Unibo/Slam-Dunk-Android

max_forks_repo_name: CVLAB-Unibo/Slam-Dunk-Android


text:
/* CirKit: A circuit toolkit
 * Copyright (C) 2009-2015  University of Bremen
 * Copyright (C) 2015-2017  EPFL
 *
 * 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 "io_utils_p.hpp"

#include <boost/format.hpp>
#include <boost/range/iterator_range.hpp>

namespace cirkit
{

std::pair<aig_function, aig_function> get_operands( const aig_node& v, const aig_graph& aig )
{
  const auto& complement = boost::get( boost::edge_complement, aig );
  std::pair<aig_function, aig_function> p;

  bool first = true;
  for ( const auto& e : boost::make_iterator_range( boost::out_edges( v, aig ) ) )
  {
    ( first ? p.first : p.second ) = {boost::target( e, aig ), complement[e]};
    first = false;
  }

  return p;
}

std::string get_node_name( const aig_node& v, const aig_graph& aig, const std::string& prefix )
{
  const auto& aig_info = boost::get_property( aig, boost::graph_name );
  if ( boost::out_degree( v, aig ) == 0u && v != aig_info.constant )
  {
    return boost::str( boost::format( "%s%s" ) % prefix % aig_info.node_names.find( v )->second );
  }
  else
  {
    return boost::str( boost::format( "%sn%d" ) % prefix % boost::get( boost::vertex_name, aig )[v] );
  }
}

std::string get_node_name_processed( const aig_node& v, const aig_graph& aig, const std::function<std::string(const std::string&)>& f, const std::string& prefix )
{
  const auto& aig_info = boost::get_property( aig, boost::graph_name );
  if ( boost::out_degree( v, aig ) == 0u && v != aig_info.constant )
  {
    return boost::str( boost::format( "%s%s" ) % prefix % f( aig_info.node_names.find( v )->second ) );
  }
  else
  {
    return boost::str( boost::format( "%sn%d" ) % prefix % boost::get( boost::vertex_name, aig )[v] );
  }
}

}

// Local Variables:
// c-basic-offset: 2
// eval: (c-set-offset 'substatement-open 0)
// eval: (c-set-offset 'innamespace 0)
// End:

max_stars_repo_name: eletesta/cirkit

max_issues_repo_name: eletesta/cirkit

max_forks_repo_name: eletesta/cirkit


text:
// Copyright 2008 Christophe Henry
// henry UNDERSCORE christophe AT hotmail DOT com
// This is an extended version of the state machine available in the boost::mpl library
// Distributed under the same license as the original.
// Copyright for the original version:
// Copyright 2005 David Abrahams and Aleksey Gurtovoy. 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_MSM_FRONT_EUML_QUERYING_H
#define BOOST_MSM_FRONT_EUML_QUERYING_H

#include <algorithm>
#include <boost/msm/front/euml/common.hpp>

namespace boost { namespace msm { namespace front { namespace euml
{

BOOST_MSM_EUML_FUNCTION(Find_ , std::find , find_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(FindIf_ , std::find_if , find_if_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(LowerBound_ , std::lower_bound , lower_bound_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(UpperBound_ , std::upper_bound , upper_bound_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(BinarySearch_ , std::binary_search , binary_search_ , bool , bool )
BOOST_MSM_EUML_FUNCTION(MinElement_ , std::min_element , min_element_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(MaxElement_ , std::max_element , max_element_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(AdjacentFind_ , std::adjacent_find , adjacent_find_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(FindEnd_ , std::find_end , find_end_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(FindFirstOf_ , std::find_first_of , find_first_of_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(Equal_ , std::equal , equal_ , bool , bool )
BOOST_MSM_EUML_FUNCTION(Search_ , std::search , search_ , RESULT_TYPE_PARAM1 , RESULT_TYPE2_PARAM1 )
BOOST_MSM_EUML_FUNCTION(Includes_ , std::includes , includes_ , bool , bool )
BOOST_MSM_EUML_FUNCTION(LexicographicalCompare_ , std::lexicographical_compare , lexicographical_compare_ , bool , bool )
BOOST_MSM_EUML_FUNCTION(Count_ , std::count , count_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
BOOST_MSM_EUML_FUNCTION(CountIf_ , std::count_if , count_if_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
BOOST_MSM_EUML_FUNCTION(Distance_ , std::distance , distance_ , RESULT_TYPE_DIFF_TYPE_ITER_TRAITS_PARAM1 , RESULT_TYPE2_DIFF_TYPE_ITER_TRAITS_PARAM1 )
BOOST_MSM_EUML_FUNCTION(EqualRange_ , std::equal_range , equal_range_ , RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 , RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 )
BOOST_MSM_EUML_FUNCTION(Mismatch_ , std::mismatch , mismatch_ , RESULT_TYPE_PAIR_REMOVE_REF_PARAM1 , RESULT_TYPE2_PAIR_REMOVE_REF_PARAM1 )

}}}}

#endif //BOOST_MSM_FRONT_EUML_QUERYING_H

max_stars_repo_name: randolphwong/mcsema

max_issues_repo_name: randolphwong/mcsema

max_forks_repo_name: randolphwong/mcsema