Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
297931e1
Commit
297931e1
authored
Apr 08, 2018
by
Leander Schulten
Browse files
Added Boost and LoopProgramm coroutines
parent
76fc833b
Changes
1000
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
20 of 1000+
files are displayed.
Plain diff
Email patch
Lichtsteuerung.pro
View file @
297931e1
...
...
@@ -100,8 +100,7 @@ HEADERS += \
programms/loopprogramm.h \
programms/dmxconsumer.h \
programms/consumer.h \
test
/
testloopprogramm
.
h
\
programms
/
coroutine
.
h
test/testloopprogramm.h
# Default rules for deployment.
...
...
@@ -112,3 +111,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
DISTFILES +=
win32-g++{
LIBS += -L$$PWD/'lib
/
boost' -lboost_coroutine -lboost_context
INCLUDEPATH += $$PWD/'boost
'
}
boost/accumulators/accumulators.hpp
0 → 100644
View file @
297931e1
///////////////////////////////////////////////////////////////////////////////
/// \file accumulators.hpp
/// Includes all of the Accumulators Framework
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005
#include
<boost/accumulators/framework/accumulator_set.hpp>
#include
<boost/accumulators/framework/accumulator_concept.hpp>
#include
<boost/accumulators/framework/accumulator_base.hpp>
#include
<boost/accumulators/framework/extractor.hpp>
#include
<boost/accumulators/framework/external.hpp>
#include
<boost/accumulators/framework/features.hpp>
#include
<boost/accumulators/framework/parameters/accumulator.hpp>
#include
<boost/accumulators/framework/parameters/sample.hpp>
#include
<boost/accumulators/framework/parameters/weight.hpp>
#include
<boost/accumulators/framework/parameters/weights.hpp>
#include
<boost/accumulators/framework/accumulators/external_accumulator.hpp>
#include
<boost/accumulators/framework/accumulators/droppable_accumulator.hpp>
#include
<boost/accumulators/framework/accumulators/reference_accumulator.hpp>
#include
<boost/accumulators/framework/accumulators/value_accumulator.hpp>
#endif
boost/accumulators/accumulators_fwd.hpp
0 → 100644
View file @
297931e1
///////////////////////////////////////////////////////////////////////////////
// accumulators_fwd.hpp
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_ACCUMULATORS_FWD_HPP_EAN_28_10_2005
#include
<boost/config.hpp>
#include
<boost/mpl/apply_fwd.hpp>
// for mpl::na
#include
<boost/mpl/limits/vector.hpp>
#include
<boost/preprocessor/cat.hpp>
#include
<boost/preprocessor/arithmetic/inc.hpp>
#include
<boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include
<boost/preprocessor/repetition/enum_trailing_params.hpp>
#include
<boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
#include
<boost/preprocessor/repetition/repeat_from_to.hpp>
#include
<boost/accumulators/numeric/functional_fwd.hpp>
#ifndef BOOST_ACCUMULATORS_MAX_FEATURES
/// The maximum number of accumulators that may be put in an accumulator_set.
/// Defaults to BOOST_MPL_LIMIT_VECTOR_SIZE (which defaults to 20).
# define BOOST_ACCUMULATORS_MAX_FEATURES BOOST_MPL_LIMIT_VECTOR_SIZE
#endif
#if BOOST_ACCUMULATORS_MAX_FEATURES > BOOST_MPL_LIMIT_VECTOR_SIZE
# error BOOST_ACCUMULATORS_MAX_FEATURES cannot be larger than BOOST_MPL_LIMIT_VECTOR_SIZE
#endif
#ifndef BOOST_ACCUMULATORS_MAX_ARGS
/// The maximum number of arguments that may be specified to an accumulator_set's
/// accumulation function. Defaults to 15.
# define BOOST_ACCUMULATORS_MAX_ARGS 15
#endif
#if BOOST_WORKAROUND(__GNUC__, == 3) \
|| BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(306))
# define BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
#endif
#ifdef BOOST_ACCUMULATORS_BROKEN_CONST_OVERLOADS
# include <boost/utility/enable_if.hpp>
# include <boost/type_traits/is_const.hpp>
# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)\
, typename boost::disable_if<boost::is_const<T> >::type * = 0
#else
# define BOOST_ACCUMULATORS_PROTO_DISABLE_IF_IS_CONST(T)
#endif
#define BOOST_ACCUMULATORS_GCC_VERSION \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
namespace
boost
{
namespace
accumulators
{
///////////////////////////////////////////////////////////////////////////////
// Named parameters tags
//
namespace
tag
{
struct
sample
;
struct
weight
;
struct
accumulator
;
struct
weights
;
}
///////////////////////////////////////////////////////////////////////////////
// User-level features
//
namespace
tag
{
template
<
typename
ValueType
,
typename
Tag
>
struct
value
;
template
<
typename
Tag
>
struct
value_tag
;
template
<
typename
Referent
,
typename
Tag
>
struct
reference
;
template
<
typename
Tag
>
struct
reference_tag
;
template
<
typename
Type
,
typename
Tag
=
void
,
typename
AccumulatorSet
=
void
>
struct
external
;
template
<
typename
Feature
>
struct
droppable
;
}
template
<
typename
Accumulator
>
struct
droppable_accumulator_base
;
template
<
typename
Accumulator
>
struct
droppable_accumulator
;
template
<
typename
Accumulator
>
struct
with_cached_result
;
template
<
typename
Sample
,
typename
Features
,
typename
Weight
=
void
>
struct
accumulator_set
;
template
<
typename
Feature
>
struct
extractor
;
template
<
typename
Feature
>
struct
feature_of
;
template
<
typename
Feature
>
struct
as_feature
;
template
<
typename
Feature
>
struct
as_weighted_feature
;
template
<
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
(
BOOST_ACCUMULATORS_MAX_FEATURES
,
typename
Feature
,
mpl
::
na
)>
struct
depends_on
;
template
<
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
(
BOOST_ACCUMULATORS_MAX_FEATURES
,
typename
Feature
,
mpl
::
na
)>
struct
features
;
template
<
typename
Feature
,
typename
AccumulatorSet
>
typename
mpl
::
apply
<
AccumulatorSet
,
Feature
>::
type
const
&
find_accumulator
(
AccumulatorSet
const
&
acc
);
template
<
typename
Feature
,
typename
AccumulatorSet
>
typename
mpl
::
apply
<
AccumulatorSet
,
Feature
>::
type
::
result_type
extract_result
(
AccumulatorSet
const
&
acc
);
template
<
typename
Feature
,
typename
AccumulatorSet
,
typename
A1
>
typename
mpl
::
apply
<
AccumulatorSet
,
Feature
>::
type
::
result_type
extract_result
(
AccumulatorSet
const
&
acc
,
A1
const
&
a1
);
// ... other overloads generated by Boost.Preprocessor:
/// INTERNAL ONLY
///
#define BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD(z, n, _) \
template< \
typename Feature \
, typename AccumulatorSet \
BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, typename A) \
> \
typename mpl::apply<AccumulatorSet, Feature>::type::result_type \
extract_result( \
AccumulatorSet const &acc \
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(z, n, A, const &a) \
);
/// INTERNAL ONLY
///
BOOST_PP_REPEAT_FROM_TO
(
2
,
BOOST_PP_INC
(
BOOST_ACCUMULATORS_MAX_ARGS
)
,
BOOST_ACCUMULATORS_EXTRACT_RESULT_FWD
,
_
)
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
template
<
typename
Feature
,
typename
AccumulatorSet
,
typename
A1
,
typename
A2
...>
typename
mpl
::
apply
<
AccumulatorSet
,
Feature
>::
type
::
result_type
extract_result
(
AccumulatorSet
const
&
acc
,
A1
const
&
a1
,
A2
const
&
a2
...);
#endif
namespace
impl
{
using
namespace
numeric
::
operators
;
template
<
typename
Accumulator
,
typename
Tag
>
struct
external_impl
;
}
namespace
detail
{
template
<
typename
Accumulator
>
struct
feature_tag
;
template
<
typename
Feature
,
typename
Sample
,
typename
Weight
>
struct
to_accumulator
;
struct
accumulator_set_base
;
template
<
typename
T
>
struct
is_accumulator_set
;
inline
void
ignore_variable
(
void
const
*
)
{}
#define BOOST_ACCUMULATORS_IGNORE_GLOBAL(X) \
namespace detail \
{ \
struct BOOST_PP_CAT(ignore_, X) \
{ \
void ignore() \
{ \
boost::accumulators::detail::ignore_variable(&X); \
} \
}; \
} \
/**/
}
}}
// namespace boost::accumulators
// For defining boost::parameter keywords that can be inherited from to
// get a nested, class-scoped keyword with the requested alias
#define BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias) \
namespace tag_namespace \
{ \
template<int Dummy = 0> \
struct name ## _ \
{ \
static char const* keyword_name() \
{ \
return #name; \
} \
static ::boost::parameter::keyword<name ## _<Dummy> > &alias; \
}; \
template<int Dummy> \
::boost::parameter::keyword<name ## _<Dummy> > &name ## _<Dummy>::alias = \
::boost::parameter::keyword<name ## _<Dummy> >::get(); \
typedef name ## _ <> name; \
} \
namespace \
{ \
::boost::parameter::keyword<tag_namespace::name> &name = \
::boost::parameter::keyword<tag_namespace::name>::get(); \
}
#endif
boost/accumulators/framework/accumulator_base.hpp
0 → 100644
View file @
297931e1
///////////////////////////////////////////////////////////////////////////////
// accumulator_base.hpp
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_BASE_HPP_EAN_28_10_2005
#include
<boost/mpl/placeholders.hpp>
#include
<boost/mpl/joint_view.hpp>
#include
<boost/mpl/single_view.hpp>
#include
<boost/mpl/fold.hpp>
#include
<boost/mpl/contains.hpp>
#include
<boost/mpl/empty_sequence.hpp>
#include
<boost/accumulators/framework/accumulator_concept.hpp>
namespace
boost
{
namespace
accumulators
{
namespace
detail
{
typedef
void
void_
;
}
///////////////////////////////////////////////////////////////////////////////
// dont_care
//
struct
dont_care
{
template
<
typename
Args
>
dont_care
(
Args
const
&
)
{
}
};
///////////////////////////////////////////////////////////////////////////////
// accumulator_base
//
struct
accumulator_base
{
// hidden if defined in derived classes
detail
::
void_
operator
()(
dont_care
)
{
}
typedef
mpl
::
false_
is_droppable
;
detail
::
void_
add_ref
(
dont_care
)
{
}
detail
::
void_
drop
(
dont_care
)
{
}
detail
::
void_
on_drop
(
dont_care
)
{
}
};
}}
// namespace boost::accumulators
#endif
boost/accumulators/framework/accumulator_concept.hpp
0 → 100644
View file @
297931e1
///////////////////////////////////////////////////////////////////////////////
// accumulator_concept.hpp
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_CONCEPT_HPP_EAN_28_10_2005
#include
<boost/concept_check.hpp>
namespace
boost
{
namespace
accumulators
{
template
<
typename
Stat
>
struct
accumulator_concept
{
void
constraints
()
{
// TODO: define the stat concept
}
Stat
stat
;
};
}}
// namespace boost::accumulators
#endif
boost/accumulators/framework/accumulator_set.hpp
0 → 100644
View file @
297931e1
///////////////////////////////////////////////////////////////////////////////
// accumulator_set.hpp
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATOR_SET_HPP_EAN_28_10_2005
#include
<boost/version.hpp>
#include
<boost/mpl/apply.hpp>
#include
<boost/mpl/assert.hpp>
#include
<boost/mpl/protect.hpp>
#include
<boost/mpl/identity.hpp>
#include
<boost/mpl/is_sequence.hpp>
#include
<boost/type_traits/is_same.hpp>
#include
<boost/type_traits/is_base_and_derived.hpp>
#include
<boost/parameter/parameters.hpp>
#include
<boost/preprocessor/repetition/repeat_from_to.hpp>
#include
<boost/preprocessor/repetition/enum_binary_params.hpp>
#include
<boost/accumulators/accumulators_fwd.hpp>
#include
<boost/accumulators/framework/depends_on.hpp>
#include
<boost/accumulators/framework/accumulator_concept.hpp>
#include
<boost/accumulators/framework/parameters/accumulator.hpp>
#include
<boost/accumulators/framework/parameters/sample.hpp>
#include
<boost/accumulators/framework/accumulators/external_accumulator.hpp>
#include
<boost/accumulators/framework/accumulators/droppable_accumulator.hpp>
#include
<boost/fusion/include/any.hpp>
#include
<boost/fusion/include/find_if.hpp>
#include
<boost/fusion/include/for_each.hpp>
#include
<boost/fusion/include/filter_view.hpp>
namespace
boost
{
namespace
accumulators
{
namespace
detail
{
///////////////////////////////////////////////////////////////////////////////
// accumulator_visitor
// wrap a boost::parameter argument pack in a Fusion extractor object
template
<
typename
Args
>
struct
accumulator_visitor
{
explicit
accumulator_visitor
(
Args
const
&
a
)
:
args
(
a
)
{
}
template
<
typename
Accumulator
>
void
operator
()(
Accumulator
&
accumulator
)
const
{
accumulator
(
this
->
args
);
}
private:
accumulator_visitor
&
operator
=
(
accumulator_visitor
const
&
);
Args
const
&
args
;
};
template
<
typename
Args
>
inline
accumulator_visitor
<
Args
>
const
make_accumulator_visitor
(
Args
const
&
args
)
{
return
accumulator_visitor
<
Args
>
(
args
);
}
typedef
parameter
::
parameters
<
parameter
::
required
<
tag
::
accumulator
>
,
parameter
::
optional
<
tag
::
sample
>
// ... and others which are not specified here...
>
accumulator_params
;
///////////////////////////////////////////////////////////////////////////////
// accumulator_set_base
struct
accumulator_set_base
{
};
///////////////////////////////////////////////////////////////////////////////
// is_accumulator_set
template
<
typename
T
>
struct
is_accumulator_set
:
is_base_and_derived
<
accumulator_set_base
,
T
>
{
};
}
// namespace detail
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4355) // warning C4355: 'this' : used in base member initializer list
#endif
///////////////////////////////////////////////////////////////////////////////
/// \brief A set of accumulators.
///
/// accumulator_set resolves the dependencies between features and ensures that
/// the accumulators in the set are updated in the proper order.
///
/// acccumulator_set provides a general mechanism to visit the accumulators
/// in the set in order, with or without a filter. You can also fetch a reference
/// to an accumulator that corresponds to a feature.
///
template
<
typename
Sample
,
typename
Features
,
typename
Weight
>
struct
accumulator_set
:
detail
::
accumulator_set_base
{
typedef
Sample
sample_type
;
///< The type of the samples that will be accumulated
typedef
Features
features_type
;
///< An MPL sequence of the features that should be accumulated.
typedef
Weight
weight_type
;
///< The type of the weight parameter. Must be a scalar. Defaults to void.
/// INTERNAL ONLY
///
typedef
typename
detail
::
make_accumulator_tuple
<
Features
,
Sample
,
Weight
>::
type
accumulators_mpl_vector
;
// generate a fusion::list of accumulators
/// INTERNAL ONLY
///
typedef
typename
detail
::
meta
::
make_acc_list
<
accumulators_mpl_vector
>::
type
accumulators_type
;
/// INTERNAL ONLY
///
//BOOST_MPL_ASSERT((mpl::is_sequence<accumulators_type>));
///////////////////////////////////////////////////////////////////////////////
/// default-construct all contained accumulators
accumulator_set
()
:
accumulators
(
detail
::
make_acc_list
(
accumulators_mpl_vector
()
,
detail
::
accumulator_params
()(
*
this
)
)
)
{
// Add-ref the Features that the user has specified
this
->
template
visit_if
<
detail
::
contains_feature_of_
<
Features
>
>
(
detail
::
make_add_ref_visitor
(
detail
::
accumulator_params
()(
*
this
))
);
}
/// \overload
///
/// \param a1 Optional named parameter to be passed to all the accumulators
template
<
typename
A1
>
explicit
accumulator_set
(
A1
const
&
a1
)
:
accumulators
(
detail
::
make_acc_list
(
accumulators_mpl_vector
()
,
detail
::
accumulator_params
()(
*
this
,
a1
)
)
)
{
// Add-ref the Features that the user has specified
this
->
template
visit_if
<
detail
::
contains_feature_of_
<
Features
>
>
(
detail
::
make_add_ref_visitor
(
detail
::
accumulator_params
()(
*
this
))
);
}
// ... other overloads generated by Boost.Preprocessor:
/// INTERNAL ONLY
///
#define BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR(z, n, _) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
accumulator_set(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, A, const &a)) \
: accumulators( \
detail::make_acc_list( \
accumulators_mpl_vector() \
, detail::accumulator_params()( \
*this BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, a) \
) \
) \
) \
{ \
/* Add-ref the Features that the user has specified */
\
this->template visit_if<detail::contains_feature_of_<Features> >( \
detail::make_add_ref_visitor(detail::accumulator_params()(*this)) \
); \
}
/// INTERNAL ONLY
///
BOOST_PP_REPEAT_FROM_TO
(
2
,
BOOST_PP_INC
(
BOOST_ACCUMULATORS_MAX_ARGS
)
,
BOOST_ACCUMULATORS_ACCUMULATOR_SET_CTOR
,
_
)
#ifdef BOOST_ACCUMULATORS_DOXYGEN_INVOKED
/// \overload
///
template
<
typename
A1
,
typename
A2
,
...>
accumulator_set
(
A1
const
&
a1
,
A2
const
&
a2
,
...);
#endif
// ... other overloads generated by Boost.Preprocessor below ...
///////////////////////////////////////////////////////////////////////////////
/// Visitation
/// \param func UnaryFunction which is invoked with each accumulator in turn.
template
<
typename
UnaryFunction
>
void
visit
(
UnaryFunction
const
&
func
)
{
fusion
::
for_each
(
this
->
accumulators
,
func
);
}
///////////////////////////////////////////////////////////////////////////////
/// Conditional visitation
/// \param func UnaryFunction which is invoked with each accumulator in turn,
/// provided the accumulator satisfies the MPL predicate FilterPred.
template
<
typename
FilterPred
,
typename
UnaryFunction
>
void
visit_if
(
UnaryFunction
const
&
func
)
{
fusion
::
filter_view
<
accumulators_type
,
FilterPred
>
filtered_accs
(
this
->
accumulators
);
fusion
::
for_each
(
filtered_accs
,
func
);
}
///////////////////////////////////////////////////////////////////////////////
/// The return type of the operator() overloads is void.
typedef
void
result_type
;
///////////////////////////////////////////////////////////////////////////////
/// Accumulation
/// \param a1 Optional named parameter to be passed to all the accumulators