Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,82 @@
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
#include <boost/proto/context/detail/preprocessed/default_eval.hpp>
#elif !defined(BOOST_PP_IS_ITERATING)
#define BOOST_PROTO_DEFAULT_EVAL_SHIFTED(Z, M, DATA) \
BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA) \
/**/
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_eval.hpp")
#endif
///////////////////////////////////////////////////////////////////////////////
/// \file default_eval.hpp
/// Contains specializations of the default_eval\<\> class template.
//
// Copyright 2008 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)
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
#define BOOST_PP_ITERATION_PARAMS_1 \
(3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/context/detail/default_eval.hpp>))
#include BOOST_PP_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#undef BOOST_PROTO_DEFAULT_EVAL_SHIFTED
#else
#define N BOOST_PP_ITERATION()
template<typename Expr, typename Context>
struct default_eval<Expr, Context, proto::tag::function, N>
{
typedef
typename proto::detail::result_of_fixup<
BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
>::type
function_type;
typedef
typename BOOST_PROTO_RESULT_OF<
function_type(BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr))
>::type
result_type;
result_type operator ()(Expr &expr, Context &context) const
{
return this->invoke(expr, context, is_member_function_pointer<function_type>());
}
private:
result_type invoke(Expr &expr, Context &context, mpl::false_) const
{
return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)(
BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, expr)
);
}
result_type invoke(Expr &expr, Context &context, mpl::true_) const
{
BOOST_PROTO_USE_GET_POINTER();
typedef typename detail::class_member_traits<function_type>::class_type class_type;
return (
BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->*
BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
)(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEFAULT_EVAL_SHIFTED, expr));
}
};
#undef N
#endif
@@ -0,0 +1,35 @@
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
// Use, modification and distribution is subject to 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)
// Message Passing Interface
// See www.boost.org/libs/mpi for documentation.
/** @file mpi.hpp
*
* This file is a top-level convenience header that includes all of
* the Boost.MPI library headers. Users concerned about compile time
* may wish to include only specific headers from the Boost.MPI
* library.
*
*/
#ifndef BOOST_MPI_HPP
#define BOOST_MPI_HPP
#include <boost/mpi/allocator.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/datatype.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/mpi/graph_communicator.hpp>
#include <boost/mpi/group.hpp>
#include <boost/mpi/intercommunicator.hpp>
#include <boost/mpi/nonblocking.hpp>
#include <boost/mpi/operations.hpp>
#include <boost/mpi/skeleton_and_content.hpp>
#include <boost/mpi/timer.hpp>
#endif // BOOST_MPI_HPP
@@ -0,0 +1,65 @@
/*
Copyright Rene Rivera 2008-2015
Copyright Franz Detro 2014
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_PREDEF_OS_MACOS_H
#define BOOST_PREDEF_OS_MACOS_H
/* Special case: iOS will define the same predefs as MacOS, and additionally
'__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__'. We can guard against that,
but only if we detect iOS first. Hence we will force include iOS detection
* before doing any MacOS detection.
*/
#include <boost/predef/os/ios.h>
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
/*`
[heading `BOOST_OS_MACOS`]
[@http://en.wikipedia.org/wiki/Mac_OS Mac OS] operating system.
[table
[[__predef_symbol__] [__predef_version__]]
[[`macintosh`] [__predef_detection__]]
[[`Macintosh`] [__predef_detection__]]
[[`__APPLE__`] [__predef_detection__]]
[[`__MACH__`] [__predef_detection__]]
[[`__APPLE__`, `__MACH__`] [10.0.0]]
[[ /otherwise/ ] [9.0.0]]
]
*/
#define BOOST_OS_MACOS BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \
defined(macintosh) || defined(Macintosh) || \
(defined(__APPLE__) && defined(__MACH__)) \
)
# undef BOOST_OS_MACOS
# if !defined(BOOST_OS_MACOS) && defined(__APPLE__) && defined(__MACH__)
# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(10,0,0)
# endif
# if !defined(BOOST_OS_MACOS)
# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(9,0,0)
# endif
#endif
#if BOOST_OS_MACOS
# define BOOST_OS_MACOS_AVAILABLE
# include <boost/predef/detail/os_detected.h>
#endif
#define BOOST_OS_MACOS_NAME "Mac OS"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_OS_MACOS,BOOST_OS_MACOS_NAME)
@@ -0,0 +1,79 @@
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>
// Use, modification and distribution is subject to 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)
// Authors: Douglas Gregor
#ifndef BOOST_MPI_PYTHON_HPP
#define BOOST_MPI_PYTHON_HPP
#include <boost/python/object.hpp>
/** @file python.hpp
*
* This header interacts with the Python bindings for Boost.MPI. The
* routines in this header can be used to register user-defined and
* library-defined data types with Boost.MPI for efficient
* (de-)serialization and separate transmission of skeletons and
* content.
*
*/
namespace boost { namespace mpi { namespace python {
/**
* @brief Register the type T for direct serialization within Boost.MPI
*
* The @c register_serialized function registers a C++ type for direct
* serialization within Boost.MPI. Direct serialization elides the use
* of the Python @c pickle package when serializing Python objects
* that represent C++ values. Direct serialization can be beneficial
* both to improve serialization performance (Python pickling can be
* very inefficient) and to permit serialization for Python-wrapped
* C++ objects that do not support pickling.
*
* @param value A sample value of the type @c T. This may be used
* to compute the Python type associated with the C++ type @c T.
*
* @param type The Python type associated with the C++ type @c
* T. If not provided, it will be computed from the same value @p
* value.
*/
template<typename T>
void
register_serialized(const T& value = T(), PyTypeObject* type = 0);
/**
* @brief Registers a type for use with the skeleton/content mechanism
* in Python.
*
* The skeleton/content mechanism can only be used from Python with
* C++ types that have previously been registered via a call to this
* function. Both the sender and the transmitter must register the
* type. It is permitted to call this function multiple times for the
* same type @c T, but only one call per process per type is
* required. The type @c T must be Serializable.
*
* @param value A sample object of type T that will be used to
* determine the Python type associated with T, if @p type is not
* specified.
*
* @param type The Python type associated with the C++ type @c
* T. If not provided, it will be computed from the same value @p
* value.
*/
template<typename T>
void
register_skeleton_and_content(const T& value = T(), PyTypeObject* type = 0);
} } } // end namespace boost::mpi::python
#ifndef BOOST_MPI_PYTHON_FORWARD_ONLY
# include <boost/mpi/python/serialize.hpp>
# include <boost/mpi/python/skeleton_and_content.hpp>
#else
# undef BOOST_MPI_PYTHON_FORWARD_ONLY
#endif
#endif // BOOST_MPI_PYTHON_HPP
@@ -0,0 +1,169 @@
#ifndef BOOST_ARCHIVE_DETAIL_CHECK_HPP
#define BOOST_ARCHIVE_DETAIL_CHECK_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#pragma inline_depth(511)
#pragma inline_recursion(on)
#endif
#if defined(__MWERKS__)
#pragma inline_depth(511)
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// check.hpp: interface for serialization system.
// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/greater.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/serialization/static_warning.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/level.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/wrapper.hpp>
namespace boost {
namespace archive {
namespace detail {
// checks for objects
template<class T>
inline void check_object_level(){
typedef
typename mpl::greater_equal<
serialization::implementation_level< T >,
mpl::int_<serialization::primitive_type>
>::type typex;
// trap attempts to serialize objects marked
// not_serializable
BOOST_STATIC_ASSERT(typex::value);
}
template<class T>
inline void check_object_versioning(){
typedef
typename mpl::or_<
typename mpl::greater<
serialization::implementation_level< T >,
mpl::int_<serialization::object_serializable>
>,
typename mpl::equal_to<
serialization::version< T >,
mpl::int_<0>
>
> typex;
// trap attempts to serialize with objects that don't
// save class information in the archive with versioning.
BOOST_STATIC_ASSERT(typex::value);
}
template<class T>
inline void check_object_tracking(){
// presume it has already been determined that
// T is not a const
BOOST_STATIC_ASSERT(! boost::is_const< T >::value);
typedef typename mpl::equal_to<
serialization::tracking_level< T >,
mpl::int_<serialization::track_never>
>::type typex;
// saving an non-const object of a type not marked "track_never)
// may be an indicator of an error usage of the
// serialization library and should be double checked.
// See documentation on object tracking. Also, see the
// "rationale" section of the documenation
// for motivation for this checking.
BOOST_STATIC_WARNING(typex::value);
}
// checks for pointers
template<class T>
inline void check_pointer_level(){
// we should only invoke this once we KNOW that T
// has been used as a pointer!!
typedef
typename mpl::or_<
typename mpl::greater<
serialization::implementation_level< T >,
mpl::int_<serialization::object_serializable>
>,
typename mpl::not_<
typename mpl::equal_to<
serialization::tracking_level< T >,
mpl::int_<serialization::track_selectively>
>
>
> typex;
// Address the following when serializing to a pointer:
// a) This type doesn't save class information in the
// archive. That is, the serialization trait implementation
// level <= object_serializable.
// b) Tracking for this type is set to "track selectively"
// in this case, indication that an object is tracked is
// not stored in the archive itself - see level == object_serializable
// but rather the existence of the operation ar >> T * is used to
// infer that an object of this type should be tracked. So, if
// you save via a pointer but don't load via a pointer the operation
// will fail on load without given any valid reason for the failure.
// So if your program traps here, consider changing the
// tracking or implementation level traits - or not
// serializing via a pointer.
BOOST_STATIC_WARNING(typex::value);
}
template<class T>
void inline check_pointer_tracking(){
typedef typename mpl::greater<
serialization::tracking_level< T >,
mpl::int_<serialization::track_never>
>::type typex;
// serializing an object of a type marked "track_never" through a pointer
// could result in creating more objects than were saved!
BOOST_STATIC_WARNING(typex::value);
}
template<class T>
inline void check_const_loading(){
typedef
typename mpl::or_<
typename boost::serialization::is_wrapper< T >,
typename mpl::not_<
typename boost::is_const< T >
>
>::type typex;
// cannot load data into a "const" object unless it's a
// wrapper around some other non-const object.
BOOST_STATIC_ASSERT(typex::value);
}
} // detail
} // archive
} // boost
#endif // BOOST_ARCHIVE_DETAIL_CHECK_HPP
@@ -0,0 +1,413 @@
//
//=======================================================================
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
//
// 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_GRAPH_BREADTH_FIRST_SEARCH_HPP
#define BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
/*
Breadth First Search Algorithm (Cormen, Leiserson, and Rivest p. 470)
*/
#include <boost/config.hpp>
#include <vector>
#include <boost/pending/queue.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_concepts.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/named_function_params.hpp>
#include <boost/graph/overloading.hpp>
#include <boost/graph/graph_concepts.hpp>
#include <boost/graph/two_bit_color_map.hpp>
#include <boost/concept/assert.hpp>
#ifdef BOOST_GRAPH_USE_MPI
#include <boost/graph/distributed/concepts.hpp>
#endif // BOOST_GRAPH_USE_MPI
namespace boost {
template <class Visitor, class Graph>
struct BFSVisitorConcept {
void constraints() {
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
vis.initialize_vertex(u, g);
vis.discover_vertex(u, g);
vis.examine_vertex(u, g);
vis.examine_edge(e, g);
vis.tree_edge(e, g);
vis.non_tree_edge(e, g);
vis.gray_target(e, g);
vis.black_target(e, g);
vis.finish_vertex(u, g);
}
Visitor vis;
Graph g;
typename graph_traits<Graph>::vertex_descriptor u;
typename graph_traits<Graph>::edge_descriptor e;
};
// Multiple-source version
template <class IncidenceGraph, class Buffer, class BFSVisitor,
class ColorMap, class SourceIterator>
void breadth_first_visit
(const IncidenceGraph& g,
SourceIterator sources_begin, SourceIterator sources_end,
Buffer& Q, BFSVisitor vis, ColorMap color)
{
BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<IncidenceGraph> ));
typedef graph_traits<IncidenceGraph> GTraits;
typedef typename GTraits::vertex_descriptor Vertex;
BOOST_CONCEPT_ASSERT(( BFSVisitorConcept<BFSVisitor, IncidenceGraph> ));
BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<ColorMap, Vertex> ));
typedef typename property_traits<ColorMap>::value_type ColorValue;
typedef color_traits<ColorValue> Color;
typename GTraits::out_edge_iterator ei, ei_end;
for (; sources_begin != sources_end; ++sources_begin) {
Vertex s = *sources_begin;
put(color, s, Color::gray()); vis.discover_vertex(s, g);
Q.push(s);
}
while (! Q.empty()) {
Vertex u = Q.top(); Q.pop(); vis.examine_vertex(u, g);
for (boost::tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) {
Vertex v = target(*ei, g); vis.examine_edge(*ei, g);
ColorValue v_color = get(color, v);
if (v_color == Color::white()) { vis.tree_edge(*ei, g);
put(color, v, Color::gray()); vis.discover_vertex(v, g);
Q.push(v);
} else { vis.non_tree_edge(*ei, g);
if (v_color == Color::gray()) vis.gray_target(*ei, g);
else vis.black_target(*ei, g);
}
} // end for
put(color, u, Color::black()); vis.finish_vertex(u, g);
} // end while
} // breadth_first_visit
// Single-source version
template <class IncidenceGraph, class Buffer, class BFSVisitor,
class ColorMap>
void breadth_first_visit
(const IncidenceGraph& g,
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
Buffer& Q, BFSVisitor vis, ColorMap color)
{
typename graph_traits<IncidenceGraph>::vertex_descriptor sources[1] = {s};
breadth_first_visit(g, sources, sources + 1, Q, vis, color);
}
template <class VertexListGraph, class SourceIterator,
class Buffer, class BFSVisitor,
class ColorMap>
void breadth_first_search
(const VertexListGraph& g,
SourceIterator sources_begin, SourceIterator sources_end,
Buffer& Q, BFSVisitor vis, ColorMap color)
{
// Initialization
typedef typename property_traits<ColorMap>::value_type ColorValue;
typedef color_traits<ColorValue> Color;
typename boost::graph_traits<VertexListGraph>::vertex_iterator i, i_end;
for (boost::tie(i, i_end) = vertices(g); i != i_end; ++i) {
vis.initialize_vertex(*i, g);
put(color, *i, Color::white());
}
breadth_first_visit(g, sources_begin, sources_end, Q, vis, color);
}
template <class VertexListGraph, class Buffer, class BFSVisitor,
class ColorMap>
void breadth_first_search
(const VertexListGraph& g,
typename graph_traits<VertexListGraph>::vertex_descriptor s,
Buffer& Q, BFSVisitor vis, ColorMap color)
{
typename graph_traits<VertexListGraph>::vertex_descriptor sources[1] = {s};
breadth_first_search(g, sources, sources + 1, Q, vis, color);
}
namespace graph { struct bfs_visitor_event_not_overridden {}; }
template <class Visitors = null_visitor>
class bfs_visitor {
public:
bfs_visitor() { }
bfs_visitor(Visitors vis) : m_vis(vis) { }
template <class Vertex, class Graph>
graph::bfs_visitor_event_not_overridden
initialize_vertex(Vertex u, Graph& g)
{
invoke_visitors(m_vis, u, g, ::boost::on_initialize_vertex());
return graph::bfs_visitor_event_not_overridden();
}
template <class Vertex, class Graph>
graph::bfs_visitor_event_not_overridden
discover_vertex(Vertex u, Graph& g)
{
invoke_visitors(m_vis, u, g, ::boost::on_discover_vertex());
return graph::bfs_visitor_event_not_overridden();
}
template <class Vertex, class Graph>
graph::bfs_visitor_event_not_overridden
examine_vertex(Vertex u, Graph& g)
{
invoke_visitors(m_vis, u, g, ::boost::on_examine_vertex());
return graph::bfs_visitor_event_not_overridden();
}
template <class Edge, class Graph>
graph::bfs_visitor_event_not_overridden
examine_edge(Edge e, Graph& g)
{
invoke_visitors(m_vis, e, g, ::boost::on_examine_edge());
return graph::bfs_visitor_event_not_overridden();
}
template <class Edge, class Graph>
graph::bfs_visitor_event_not_overridden
tree_edge(Edge e, Graph& g)
{
invoke_visitors(m_vis, e, g, ::boost::on_tree_edge());
return graph::bfs_visitor_event_not_overridden();
}
template <class Edge, class Graph>
graph::bfs_visitor_event_not_overridden
non_tree_edge(Edge e, Graph& g)
{
invoke_visitors(m_vis, e, g, ::boost::on_non_tree_edge());
return graph::bfs_visitor_event_not_overridden();
}
template <class Edge, class Graph>
graph::bfs_visitor_event_not_overridden
gray_target(Edge e, Graph& g)
{
invoke_visitors(m_vis, e, g, ::boost::on_gray_target());
return graph::bfs_visitor_event_not_overridden();
}
template <class Edge, class Graph>
graph::bfs_visitor_event_not_overridden
black_target(Edge e, Graph& g)
{
invoke_visitors(m_vis, e, g, ::boost::on_black_target());
return graph::bfs_visitor_event_not_overridden();
}
template <class Vertex, class Graph>
graph::bfs_visitor_event_not_overridden
finish_vertex(Vertex u, Graph& g)
{
invoke_visitors(m_vis, u, g, ::boost::on_finish_vertex());
return graph::bfs_visitor_event_not_overridden();
}
BOOST_GRAPH_EVENT_STUB(on_initialize_vertex,bfs)
BOOST_GRAPH_EVENT_STUB(on_discover_vertex,bfs)
BOOST_GRAPH_EVENT_STUB(on_examine_vertex,bfs)
BOOST_GRAPH_EVENT_STUB(on_examine_edge,bfs)
BOOST_GRAPH_EVENT_STUB(on_tree_edge,bfs)
BOOST_GRAPH_EVENT_STUB(on_non_tree_edge,bfs)
BOOST_GRAPH_EVENT_STUB(on_gray_target,bfs)
BOOST_GRAPH_EVENT_STUB(on_black_target,bfs)
BOOST_GRAPH_EVENT_STUB(on_finish_vertex,bfs)
protected:
Visitors m_vis;
};
template <class Visitors>
bfs_visitor<Visitors>
make_bfs_visitor(Visitors vis) {
return bfs_visitor<Visitors>(vis);
}
typedef bfs_visitor<> default_bfs_visitor;
namespace detail {
template <class VertexListGraph, class ColorMap, class BFSVisitor,
class P, class T, class R>
void bfs_helper
(VertexListGraph& g,
typename graph_traits<VertexListGraph>::vertex_descriptor s,
ColorMap color,
BFSVisitor vis,
const bgl_named_params<P, T, R>& params,
boost::mpl::false_)
{
typedef graph_traits<VertexListGraph> Traits;
// Buffer default
typedef typename Traits::vertex_descriptor Vertex;
typedef boost::queue<Vertex> queue_t;
queue_t Q;
breadth_first_search
(g, s,
choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
vis, color);
}
#ifdef BOOST_GRAPH_USE_MPI
template <class DistributedGraph, class ColorMap, class BFSVisitor,
class P, class T, class R>
void bfs_helper
(DistributedGraph& g,
typename graph_traits<DistributedGraph>::vertex_descriptor s,
ColorMap color,
BFSVisitor vis,
const bgl_named_params<P, T, R>& params,
boost::mpl::true_);
#endif // BOOST_GRAPH_USE_MPI
//-------------------------------------------------------------------------
// Choose between default color and color parameters. Using
// function dispatching so that we don't require vertex index if
// the color default is not being used.
template <class ColorMap>
struct bfs_dispatch {
template <class VertexListGraph, class P, class T, class R>
static void apply
(VertexListGraph& g,
typename graph_traits<VertexListGraph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params,
ColorMap color)
{
bfs_helper
(g, s, color,
choose_param(get_param(params, graph_visitor),
make_bfs_visitor(null_visitor())),
params,
boost::mpl::bool_<
boost::is_base_and_derived<
distributed_graph_tag,
typename graph_traits<VertexListGraph>::traversal_category>::value>());
}
};
template <>
struct bfs_dispatch<param_not_found> {
template <class VertexListGraph, class P, class T, class R>
static void apply
(VertexListGraph& g,
typename graph_traits<VertexListGraph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params,
param_not_found)
{
null_visitor null_vis;
bfs_helper
(g, s,
make_two_bit_color_map
(num_vertices(g),
choose_const_pmap(get_param(params, vertex_index),
g, vertex_index)),
choose_param(get_param(params, graph_visitor),
make_bfs_visitor(null_vis)),
params,
boost::mpl::bool_<
boost::is_base_and_derived<
distributed_graph_tag,
typename graph_traits<VertexListGraph>::traversal_category>::value>());
}
};
} // namespace detail
#if 1
// Named Parameter Variant
template <class VertexListGraph, class P, class T, class R>
void breadth_first_search
(const VertexListGraph& g,
typename graph_traits<VertexListGraph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params)
{
// The graph is passed by *const* reference so that graph adaptors
// (temporaries) can be passed into this function. However, the
// graph is not really const since we may write to property maps
// of the graph.
VertexListGraph& ng = const_cast<VertexListGraph&>(g);
typedef typename get_param_type< vertex_color_t, bgl_named_params<P,T,R> >::type C;
detail::bfs_dispatch<C>::apply(ng, s, params,
get_param(params, vertex_color));
}
#endif
// This version does not initialize colors, user has to.
template <class IncidenceGraph, class P, class T, class R>
void breadth_first_visit
(const IncidenceGraph& g,
typename graph_traits<IncidenceGraph>::vertex_descriptor s,
const bgl_named_params<P, T, R>& params)
{
// The graph is passed by *const* reference so that graph adaptors
// (temporaries) can be passed into this function. However, the
// graph is not really const since we may write to property maps
// of the graph.
IncidenceGraph& ng = const_cast<IncidenceGraph&>(g);
typedef graph_traits<IncidenceGraph> Traits;
// Buffer default
typedef typename Traits::vertex_descriptor vertex_descriptor;
typedef boost::queue<vertex_descriptor> queue_t;
queue_t Q;
breadth_first_visit
(ng, s,
choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(),
choose_param(get_param(params, graph_visitor),
make_bfs_visitor(null_visitor())),
choose_pmap(get_param(params, vertex_color), ng, vertex_color)
);
}
namespace graph {
namespace detail {
template <typename Graph, typename Source>
struct breadth_first_search_impl {
typedef void result_type;
template <typename ArgPack>
void operator()(const Graph& g, const Source& source, const ArgPack& arg_pack) {
using namespace boost::graph::keywords;
typename boost::graph_traits<Graph>::vertex_descriptor sources[1] = {source};
boost::queue<typename boost::graph_traits<Graph>::vertex_descriptor> Q;
boost::breadth_first_search(g,
&sources[0],
&sources[1],
boost::unwrap_ref(arg_pack[_buffer | boost::ref(Q)]),
arg_pack[_visitor | make_bfs_visitor(null_visitor())],
boost::detail::make_color_map_from_arg_pack(g, arg_pack));
}
};
}
BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(breadth_first_search, 2, 4)
}
#if 0
// Named Parameter Variant
BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(breadth_first_search, 2)
#endif
} // namespace boost
#ifdef BOOST_GRAPH_USE_MPI
# include <boost/graph/distributed/breadth_first_search.hpp>
#endif
#endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
@@ -0,0 +1,138 @@
#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace archive {
namespace detail {
template<class Archive> class interface_oarchive;
} // namespace detail
//////////////////////////////////////////////////////////////////////
// class basic_xml_oarchive - write serialized objects to a xml output stream
template<class Archive>
class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
public detail::common_oarchive<Archive>
{
// special stuff for xml output
unsigned int depth;
bool pending_preamble;
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
public:
#else
protected:
friend class detail::interface_oarchive<Archive>;
#endif
bool indent_next;
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
indent();
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
init();
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
windup();
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
write_attribute(
const char *attribute_name,
int t,
const char *conjunction = "=\""
);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
write_attribute(
const char *attribute_name,
const char *key
);
// helpers used below
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_start(const char *name);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_end(const char *name);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
end_preamble();
// Anything not an attribute and not a name-value pair is an
// error and should be trapped here.
template<class T>
void save_override(T & t)
{
// If your program fails to compile here, its most likely due to
// not specifying an nvp wrapper around the variable to
// be serialized.
BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
this->detail_common_oarchive::save_override(t);
}
// special treatment for name-value pairs.
typedef detail::common_oarchive<Archive> detail_common_oarchive;
template<class T>
void save_override(
const ::boost::serialization::nvp< T > & t
){
this->This()->save_start(t.name());
this->detail_common_oarchive::save_override(t.const_value());
this->This()->save_end(t.name());
}
// specific overrides for attributes - not name value pairs so we
// want to trap them before the above "fall through"
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const class_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const class_id_optional_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const class_id_reference_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const object_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const object_reference_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const version_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const class_name_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_override(const tracking_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_xml_oarchive(unsigned int flags);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
~basic_xml_oarchive();
};
} // namespace archive
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
@@ -0,0 +1,68 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP
#define BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP
#include <iterator>
#include <boost/compute/container/detail/scalar.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/iterator_range_size.hpp>
namespace boost {
namespace compute {
namespace detail {
// counts values that match the predicate using a single thread
template<class InputIterator, class Predicate>
inline size_t serial_count_if(InputIterator first,
InputIterator last,
Predicate predicate,
command_queue &queue)
{
typedef typename std::iterator_traits<InputIterator>::value_type value_type;
const context &context = queue.get_context();
size_t size = iterator_range_size(first, last);
meta_kernel k("serial_count_if");
k.add_set_arg("size", static_cast<uint_>(size));
size_t result_arg = k.add_arg<uint_ *>(memory_object::global_memory, "result");
k <<
"uint count = 0;\n" <<
"for(uint i = 0; i < size; i++){\n" <<
k.decl<const value_type>("value") << "="
<< first[k.var<uint_>("i")] << ";\n" <<
"if(" << predicate(k.var<const value_type>("value")) << "){\n" <<
"count++;\n" <<
"}\n"
"}\n"
"*result = count;\n";
kernel kernel = k.compile(context);
// setup result buffer
scalar<uint_> result(context);
kernel.set_arg(result_arg, result.get_buffer());
// run kernel
queue.enqueue_task(kernel);
// read index
return result.read(queue);
}
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_ALGORITHM_DETAIL_SERIAL_COUNT_IF_HPP
@@ -0,0 +1,601 @@
// (C) Copyright Jeremy Siek 2004
// (C) Copyright Thomas Claveirole 2010
// (C) Copyright Ignacy Gawedzki 2010
// 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_GRAPH_DETAIL_CONTAINER_TRAITS_H
#define BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H
// Sure would be nice to be able to forward declare these
// instead of pulling in all the headers. Too bad that
// is not legal. There ought to be a standard <stlfwd> header. -JGS
#include <boost/next_prior.hpp>
#include <algorithm> // for std::remove
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
#include <unordered_set>
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
#include <unordered_map>
#endif
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_PENDING_FWD_TYPE(type) const type&
#define BOOST_PENDING_FWD_VALUE(type, var) (var)
#else
#define BOOST_PENDING_FWD_TYPE(type) type&&
#define BOOST_PENDING_FWD_VALUE(type, var) (std::forward<type>((var)))
#endif
// The content of this file is in 'graph_detail' because otherwise
// there will be name clashes with
// sandbox/boost/sequence_algo/container_traits.hpp
// The 'detail' subnamespace will still cause problems.
namespace boost { namespace graph_detail {
//======================================================================
// Container Category Tags
//
// They use virtual inheritance because there are lots of
// inheritance diamonds.
struct container_tag { };
struct forward_container_tag : virtual public container_tag { };
struct reversible_container_tag : virtual public forward_container_tag { };
struct random_access_container_tag
: virtual public reversible_container_tag { };
struct sequence_tag : virtual public forward_container_tag { };
struct associative_container_tag : virtual public forward_container_tag { };
struct sorted_associative_container_tag
: virtual public associative_container_tag,
virtual public reversible_container_tag { };
struct front_insertion_sequence_tag : virtual public sequence_tag { };
struct back_insertion_sequence_tag : virtual public sequence_tag { };
struct unique_associative_container_tag
: virtual public associative_container_tag { };
struct multiple_associative_container_tag
: virtual public associative_container_tag { };
struct simple_associative_container_tag
: virtual public associative_container_tag { };
struct pair_associative_container_tag
: virtual public associative_container_tag { };
//======================================================================
// Iterator Stability Tags
//
// Do mutating operations such as insert/erase/resize invalidate all
// outstanding iterators?
struct stable_tag { };
struct unstable_tag { };
//======================================================================
// Container Traits Class and container_category() function
// don't use this unless there is partial specialization
template <class Container>
struct container_traits {
typedef typename Container::category category;
typedef typename Container::iterator_stability iterator_stability;
};
// Use this as a compile-time assertion that X is stable
inline void require_stable(stable_tag) { }
// std::vector
struct vector_tag :
virtual public random_access_container_tag,
virtual public back_insertion_sequence_tag { };
template <class T, class Alloc>
vector_tag container_category(const std::vector<T,Alloc>&)
{ return vector_tag(); }
template <class T, class Alloc>
unstable_tag iterator_stability(const std::vector<T,Alloc>&)
{ return unstable_tag(); }
template <class T, class Alloc>
struct container_traits< std::vector<T,Alloc> > {
typedef vector_tag category;
typedef unstable_tag iterator_stability;
};
// std::list
struct list_tag :
virtual public reversible_container_tag,
virtual public back_insertion_sequence_tag
// this causes problems for push_dispatch...
// virtual public front_insertion_sequence_tag
{ };
template <class T, class Alloc>
list_tag container_category(const std::list<T,Alloc>&)
{ return list_tag(); }
template <class T, class Alloc>
stable_tag iterator_stability(const std::list<T,Alloc>&)
{ return stable_tag(); }
template <class T, class Alloc>
struct container_traits< std::list<T,Alloc> > {
typedef list_tag category;
typedef stable_tag iterator_stability;
};
// std::set
struct set_tag :
virtual public sorted_associative_container_tag,
virtual public simple_associative_container_tag,
virtual public unique_associative_container_tag
{ };
template <class Key, class Cmp, class Alloc>
set_tag container_category(const std::set<Key,Cmp,Alloc>&)
{ return set_tag(); }
template <class Key, class Cmp, class Alloc>
stable_tag iterator_stability(const std::set<Key,Cmp,Alloc>&)
{ return stable_tag(); }
template <class Key, class Cmp, class Alloc>
struct container_traits< std::set<Key,Cmp,Alloc> > {
typedef set_tag category;
typedef stable_tag iterator_stability;
};
// std::multiset
struct multiset_tag :
virtual public sorted_associative_container_tag,
virtual public simple_associative_container_tag,
virtual public multiple_associative_container_tag
{ };
template <class Key, class Cmp, class Alloc>
multiset_tag container_category(const std::multiset<Key,Cmp,Alloc>&)
{ return multiset_tag(); }
template <class Key, class Cmp, class Alloc>
stable_tag iterator_stability(const std::multiset<Key,Cmp,Alloc>&)
{ return stable_tag(); }
template <class Key, class Cmp, class Alloc>
struct container_traits< std::multiset<Key,Cmp,Alloc> > {
typedef multiset_tag category;
typedef stable_tag iterator_stability;
};
// deque
// std::map
struct map_tag :
virtual public sorted_associative_container_tag,
virtual public pair_associative_container_tag,
virtual public unique_associative_container_tag
{ };
template <class Key, class T, class Cmp, class Alloc>
struct container_traits< std::map<Key,T,Cmp,Alloc> > {
typedef map_tag category;
typedef stable_tag iterator_stability;
};
template <class Key, class T, class Cmp, class Alloc>
map_tag container_category(const std::map<Key,T,Cmp,Alloc>&)
{ return map_tag(); }
template <class Key, class T, class Cmp, class Alloc>
stable_tag iterator_stability(const std::map<Key,T,Cmp,Alloc>&)
{ return stable_tag(); }
// std::multimap
struct multimap_tag :
virtual public sorted_associative_container_tag,
virtual public pair_associative_container_tag,
virtual public multiple_associative_container_tag
{ };
template <class Key, class T, class Cmp, class Alloc>
struct container_traits< std::multimap<Key,T,Cmp,Alloc> > {
typedef multimap_tag category;
typedef stable_tag iterator_stability;
};
template <class Key, class T, class Cmp, class Alloc>
multimap_tag container_category(const std::multimap<Key,T,Cmp,Alloc>&)
{ return multimap_tag(); }
template <class Key, class T, class Cmp, class Alloc>
stable_tag iterator_stability(const std::multimap<Key,T,Cmp,Alloc>&)
{ return stable_tag(); }
// hash_set, hash_map
struct unordered_set_tag :
virtual public simple_associative_container_tag,
virtual public unique_associative_container_tag
{ };
struct unordered_multiset_tag :
virtual public simple_associative_container_tag,
virtual public multiple_associative_container_tag
{ };
struct unordered_map_tag :
virtual public pair_associative_container_tag,
virtual public unique_associative_container_tag
{ };
struct unordered_multimap_tag :
virtual public pair_associative_container_tag,
virtual public multiple_associative_container_tag
{ };
template <class Key, class Eq, class Hash, class Alloc>
struct container_traits< boost::unordered_set<Key,Eq,Hash,Alloc> > {
typedef unordered_set_tag category;
typedef unstable_tag iterator_stability;
};
template <class Key, class T, class Eq, class Hash, class Alloc>
struct container_traits< boost::unordered_map<Key,T,Eq,Hash,Alloc> > {
typedef unordered_map_tag category;
typedef unstable_tag iterator_stability;
};
template <class Key, class Eq, class Hash, class Alloc>
struct container_traits< boost::unordered_multiset<Key,Eq,Hash,Alloc> > {
typedef unordered_multiset_tag category;
typedef unstable_tag iterator_stability;
};
template <class Key, class T, class Eq, class Hash, class Alloc>
struct container_traits< boost::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
typedef unordered_multimap_tag category;
typedef unstable_tag iterator_stability;
};
template <class Key, class Eq, class Hash, class Alloc>
unordered_set_tag
container_category(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
{ return unordered_set_tag(); }
template <class Key, class T, class Eq, class Hash, class Alloc>
unordered_map_tag
container_category(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
{ return unordered_map_tag(); }
template <class Key, class Eq, class Hash, class Alloc>
unstable_tag iterator_stability(const boost::unordered_set<Key,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
template <class Key, class T, class Eq, class Hash, class Alloc>
unstable_tag iterator_stability(const boost::unordered_map<Key,T,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
template <class Key, class Eq, class Hash, class Alloc>
unordered_multiset_tag
container_category(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
{ return unordered_multiset_tag(); }
template <class Key, class T, class Eq, class Hash, class Alloc>
unordered_multimap_tag
container_category(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
{ return unordered_multimap_tag(); }
template <class Key, class Eq, class Hash, class Alloc>
unstable_tag
iterator_stability(const boost::unordered_multiset<Key,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
template <class Key, class T, class Eq, class Hash, class Alloc>
unstable_tag
iterator_stability(const boost::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
struct container_traits< std::unordered_set<Key,Eq,Hash,Alloc> > {
typedef unordered_set_tag category;
typedef unstable_tag iterator_stability;
};
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
struct container_traits< std::unordered_map<Key,T,Eq,Hash,Alloc> > {
typedef unordered_map_tag category;
typedef unstable_tag iterator_stability;
};
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
struct container_traits< std::unordered_multiset<Key,Eq,Hash,Alloc> > {
typedef unordered_multiset_tag category;
typedef unstable_tag iterator_stability;
};
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
struct container_traits< std::unordered_multimap<Key,T,Eq,Hash,Alloc> > {
typedef unordered_multimap_tag category;
typedef unstable_tag iterator_stability;
};
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
unordered_set_tag
container_category(const std::unordered_set<Key,Eq,Hash,Alloc>&)
{ return unordered_set_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
unordered_map_tag
container_category(const std::unordered_map<Key,T,Eq,Hash,Alloc>&)
{ return unordered_map_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
unstable_tag iterator_stability(const std::unordered_set<Key,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
unstable_tag iterator_stability(const std::unordered_map<Key,T,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
unordered_multiset_tag
container_category(const std::unordered_multiset<Key,Eq,Hash,Alloc>&)
{ return unordered_multiset_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
unordered_multimap_tag
container_category(const std::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
{ return unordered_multimap_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
template <class Key, class Eq, class Hash, class Alloc>
unstable_tag
iterator_stability(const std::unordered_multiset<Key,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
#endif
#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
template <class Key, class T, class Eq, class Hash, class Alloc>
unstable_tag
iterator_stability(const std::unordered_multimap<Key,T,Eq,Hash,Alloc>&)
{ return unstable_tag(); }
#endif
//===========================================================================
// Generalized Container Functions
// Erase
template <class Sequence, class T>
void erase_dispatch(Sequence& c, const T& x,
sequence_tag)
{
c.erase(std::remove(c.begin(), c.end(), x), c.end());
}
template <class AssociativeContainer, class T>
void erase_dispatch(AssociativeContainer& c, const T& x,
associative_container_tag)
{
c.erase(x);
}
template <class Container, class T>
void erase(Container& c, const T& x)
{
erase_dispatch(c, x, container_category(c));
}
// Erase If
template <class Sequence, class Predicate, class IteratorStability>
void erase_if_dispatch(Sequence& c, Predicate p,
sequence_tag, IteratorStability)
{
#if 0
c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
#else
if (! c.empty())
c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
#endif
}
template <class AssociativeContainer, class Predicate>
void erase_if_dispatch(AssociativeContainer& c, Predicate p,
associative_container_tag, stable_tag)
{
typename AssociativeContainer::iterator i, next;
for (i = next = c.begin(); next != c.end(); i = next) {
++next;
if (p(*i))
c.erase(i);
}
}
template <class AssociativeContainer, class Predicate>
void erase_if_dispatch(AssociativeContainer& c, Predicate p,
associative_container_tag, unstable_tag)
{
// This method is really slow, so hopefully we won't have any
// associative containers with unstable iterators!
// Is there a better way to do this?
typename AssociativeContainer::iterator i;
typename AssociativeContainer::size_type n = c.size();
while (n--)
for (i = c.begin(); i != c.end(); ++i)
if (p(*i)) {
c.erase(i);
break;
}
}
template <class Container, class Predicate>
void erase_if(Container& c, Predicate p)
{
erase_if_dispatch(c, p, container_category(c), iterator_stability(c));
}
// Push
template <class Container, class T>
std::pair<typename Container::iterator, bool>
push_dispatch(Container& c, BOOST_PENDING_FWD_TYPE(T) v, back_insertion_sequence_tag)
{
c.push_back(BOOST_PENDING_FWD_VALUE(T, v));
return std::make_pair(boost::prior(c.end()), true);
}
template <class Container, class T>
std::pair<typename Container::iterator, bool>
push_dispatch(Container& c, BOOST_PENDING_FWD_TYPE(T) v, front_insertion_sequence_tag)
{
c.push_front(BOOST_PENDING_FWD_VALUE(T, v));
return std::make_pair(c.begin(), true);
}
template <class AssociativeContainer, class T>
std::pair<typename AssociativeContainer::iterator, bool>
push_dispatch(AssociativeContainer& c, BOOST_PENDING_FWD_TYPE(T) v,
unique_associative_container_tag)
{
return c.insert(BOOST_PENDING_FWD_VALUE(T, v));
}
template <class AssociativeContainer, class T>
std::pair<typename AssociativeContainer::iterator, bool>
push_dispatch(AssociativeContainer& c, BOOST_PENDING_FWD_TYPE(T) v,
multiple_associative_container_tag)
{
return std::make_pair(c.insert(BOOST_PENDING_FWD_VALUE(T, v)), true);
}
template <class Container, class T>
std::pair<typename Container::iterator,bool>
push(Container& c, BOOST_PENDING_FWD_TYPE(T) v)
{
return push_dispatch(c, BOOST_PENDING_FWD_VALUE(T, v), container_category(c));
}
// Find
template <class Container, class Value>
typename Container::iterator
find_dispatch(Container& c,
const Value& value,
container_tag)
{
return std::find(c.begin(), c.end(), value);
}
template <class AssociativeContainer, class Value>
typename AssociativeContainer::iterator
find_dispatch(AssociativeContainer& c,
const Value& value,
associative_container_tag)
{
return c.find(value);
}
template <class Container, class Value>
typename Container::iterator
find(Container& c,
const Value& value)
{
return find_dispatch(c, value,
graph_detail::container_category(c));
}
// Find (const versions)
template <class Container, class Value>
typename Container::const_iterator
find_dispatch(const Container& c,
const Value& value,
container_tag)
{
return std::find(c.begin(), c.end(), value);
}
template <class AssociativeContainer, class Value>
typename AssociativeContainer::const_iterator
find_dispatch(const AssociativeContainer& c,
const Value& value,
associative_container_tag)
{
return c.find(value);
}
template <class Container, class Value>
typename Container::const_iterator
find(const Container& c,
const Value& value)
{
return find_dispatch(c, value,
graph_detail::container_category(c));
}
// Equal range
#if 0
// Make the dispatch fail if c is not an Associative Container (and thus
// doesn't have equal_range unless it is sorted, which we cannot check
// statically and is not typically true for BGL's uses of this function).
template <class Container,
class LessThanComparable>
std::pair<typename Container::iterator, typename Container::iterator>
equal_range_dispatch(Container& c,
const LessThanComparable& value,
container_tag)
{
// c must be sorted for std::equal_range to behave properly.
return std::equal_range(c.begin(), c.end(), value);
}
#endif
template <class AssociativeContainer, class Value>
std::pair<typename AssociativeContainer::iterator,
typename AssociativeContainer::iterator>
equal_range_dispatch(AssociativeContainer& c,
const Value& value,
associative_container_tag)
{
return c.equal_range(value);
}
template <class Container, class Value>
std::pair<typename Container::iterator, typename Container::iterator>
equal_range(Container& c,
const Value& value)
{
return equal_range_dispatch(c, value,
graph_detail::container_category(c));
}
}} // namespace boost::graph_detail
#undef BOOST_PENDING_FWD_TYPE
#undef BOOST_PENDING_FWD_VALUE
#endif // BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H
@@ -0,0 +1,322 @@
#include "WFPalette.hpp"
#include <stdexcept>
#include <memory>
#include <algorithm>
#include <QMetaType>
#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QString>
#include <QDialog>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QColorDialog>
#include <QColor>
#include <QBrush>
#include <QPoint>
#include <QMenu>
#include <QAction>
#include <QPushButton>
#include <QStandardPaths>
#include <QFileDialog>
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include "qt_helpers.hpp"
#include "ui_wf_palette_design_dialog.h"
namespace
{
int constexpr points {256};
using Colours = WFPalette::Colours;
// ensure that palette colours are useable for interpolation
Colours make_valid (Colours colours)
{
if (colours.size () < 2)
{
// allow single element by starting at black
colours.prepend (QColor {0, 0, 0});
}
if (1 == colours.size ())
{
// allow empty list by using black to white
colours.append (QColor {255,255,255});
}
if (colours.size () > points)
{
throw_qstring (QObject::tr ("Too many colours in palette."));
}
return colours;
}
// load palette colours from a file
Colours load_palette (QString const& file_name)
{
Colours colours;
QFile file {file_name};
if (file.open (QIODevice::ReadOnly))
{
unsigned count {0};
QTextStream in (&file);
int line_counter {0};
while (!in.atEnd ())
{
auto line = in.readLine();
++line_counter;
if (++count >= points)
{
throw_qstring (QObject::tr ("Error reading waterfall palette file \"%1:%2\" too many colors.")
.arg (file.fileName ()).arg (line_counter));
}
auto items = line.split (';');
if (items.size () != 3)
{
throw_qstring (QObject::tr ("Error reading waterfall palette file \"%1:%2\" invalid triplet.")
.arg (file.fileName ()).arg (line_counter));
}
bool r_ok, g_ok, b_ok;
auto r = items[0].toInt (&r_ok);
auto g = items[1].toInt (&g_ok);
auto b = items[2].toInt (&b_ok);
if (!r_ok || !g_ok || !b_ok
|| r < 0 || r > 255
|| g < 0 || g > 255
|| b < 0 || b > 255)
{
throw_qstring (QObject::tr ("Error reading waterfall palette file \"%1:%2\" invalid color.")
.arg (file.fileName ()).arg (line_counter));
}
colours.append (QColor {r, g, b});
}
}
else
{
throw_qstring (QObject::tr ("Error opening waterfall palette file \"%1\": %2.").arg (file.fileName ()).arg (file.errorString ()));
}
return colours;
}
// GUI to design and manage waterfall palettes
class Designer
: public QDialog
{
Q_OBJECT;
public:
explicit Designer (Colours const& current, QWidget * parent = nullptr)
: QDialog {parent}
, colours_ {current}
{
ui_.setupUi (this);
// context menu actions
auto import_button = ui_.button_box->addButton ("&Import...", QDialogButtonBox::ActionRole);
connect (import_button, &QPushButton::clicked, this, &Designer::import_palette);
auto export_button = ui_.button_box->addButton ("&Export...", QDialogButtonBox::ActionRole);
connect (export_button, &QPushButton::clicked, this, &Designer::export_palette);
// hookup the context menu handler
connect (ui_.colour_table_widget, &QWidget::customContextMenuRequested, this, &Designer::context_menu);
load_table ();
}
void load_table ()
{
// load the table items
ui_.colour_table_widget->clear ();
ui_.colour_table_widget->setRowCount (colours_.size ());
for (int i {0}; i < colours_.size (); ++i)
{
insert_item (i);
}
}
Colours colours () const
{
return colours_;
}
// invoke the colour editor
Q_SLOT void on_colour_table_widget_itemDoubleClicked (QTableWidgetItem * item)
{
auto new_colour = QColorDialog::getColor (item->background ().color (), this);
if (new_colour.isValid ())
{
item->setBackground (QBrush {new_colour});
colours_[item->row ()] = new_colour;
}
}
private:
void insert_item (int row)
{
std::unique_ptr<QTableWidgetItem> item {new QTableWidgetItem {""}};
item->setBackground (QBrush {colours_[row]});
item->setFlags (Qt::ItemIsEnabled);
ui_.colour_table_widget->setItem (row, 0, item.release ());
}
void insert_new_item (int row, QColor const& default_colour)
{
// use the prior row colour as default if available
auto new_colour = QColorDialog::getColor (row > 0 ? colours_[row - 1] : default_colour, this);
if (new_colour.isValid ())
{
ui_.colour_table_widget->insertRow (row);
colours_.insert (row, new_colour);
insert_item (row);
}
}
void context_menu (QPoint const& p)
{
context_menu_.clear ();
if (ui_.colour_table_widget->itemAt (p))
{
auto delete_action = context_menu_.addAction (tr ("&Delete"));
connect (delete_action, &QAction::triggered, [this] ()
{
auto row = ui_.colour_table_widget->currentRow ();
ui_.colour_table_widget->removeRow (row);
colours_.removeAt (row);
});
}
auto insert_action = context_menu_.addAction (tr ("&Insert ..."));
connect (insert_action, &QAction::triggered, [this] ()
{
auto item = ui_.colour_table_widget->itemAt (menu_pos_);
int row = item ? item->row () : colours_.size ();
insert_new_item (row, QColor {0, 0, 0});
});
auto insert_after_action = context_menu_.addAction (tr ("Insert &after ..."));
connect (insert_after_action, &QAction::triggered, [this] ()
{
auto item = ui_.colour_table_widget->itemAt (menu_pos_);
int row = item ? item->row () + 1 : colours_.size ();
insert_new_item( row, QColor {255, 255, 255});
});
menu_pos_ = p; // save for context menu action handlers
context_menu_.popup (ui_.colour_table_widget->mapToGlobal (p));
}
void import_palette ()
{
auto docs = QStandardPaths::writableLocation (QStandardPaths::DocumentsLocation);
auto file_name = QFileDialog::getOpenFileName (this, tr ("Import Palette"), docs, tr ("Palettes (*.pal)"));
if (!file_name.isEmpty ())
{
colours_ = load_palette (file_name);
load_table ();
}
}
void export_palette ()
{
auto docs = QStandardPaths::writableLocation (QStandardPaths::DocumentsLocation);
auto file_name = QFileDialog::getSaveFileName (this, tr ("Export Palette"), docs, tr ("Palettes (*.pal)"));
if (!file_name.isEmpty ())
{
if (!QFile::exists (file_name) && !file_name.contains ('.'))
{
file_name += ".pal";
}
QFile file {file_name};
if (file.open (QFile::WriteOnly | QFile::Truncate | QFile::Text))
{
QTextStream stream {&file};
Q_FOREACH (auto colour, colours_)
{
stream << colour.red () << ';' << colour.green () << ';' << colour.blue () << endl;
}
}
else
{
throw_qstring (QObject::tr ("Error writing waterfall palette file \"%1\": %2.").arg (file.fileName ()).arg (file.errorString ()));
}
}
}
Ui::wf_palette_design_dialog ui_;
Colours colours_;
QMenu context_menu_;
QPoint menu_pos_;
};
}
#include "WFPalette.moc"
WFPalette::WFPalette (QString const& file_path)
: colours_ {load_palette (file_path)}
{
}
WFPalette::WFPalette (QList<QColor> const& colour_list)
: colours_ {colour_list}
{
}
// generate an array of colours suitable for the waterfall plotter
QVector<QColor> WFPalette::interpolate () const
{
Colours colours {make_valid (colours_)};
QVector<QColor> result;
result.reserve (points);
// do a linear-ish gradient between each supplied colour point
auto interval = qreal (points) / (colours.size () - 1);
for (int i {0}; i < points; ++i)
{
int prior = i / interval;
if (prior >= (colours.size () - 1))
{
--prior;
}
auto next = prior + 1;
if (next >= colours.size ())
{
--next;
}
// qDebug () << "WFPalette::interpolate: prior:" << prior << "total:" << colours.size ();
auto increment = i - qreal (interval) * prior;
qreal r {colours[prior].redF () + (increment * (colours[next].redF () - colours[prior].redF ()))/interval};
qreal g {colours[prior].greenF () + (increment * (colours[next].greenF () - colours[prior].greenF ()))/interval};
qreal b {colours[prior].blueF () + (increment * (colours[next].blueF () - colours[prior].blueF ()))/interval};
result.append (QColor::fromRgbF (r, g, b));
// qDebug () << "Palette colour[" << (result.size () - 1) << "] =" << result[result.size () - 1] << "from: r:" << r << "g:" << g << "b:" << b;
}
return result;
}
// invoke the palette designer
bool WFPalette::design ()
{
Designer designer {colours_};
if (QDialog::Accepted == designer.exec ())
{
colours_ = designer.colours ();
return true;
}
return false;
}
@@ -0,0 +1,156 @@
// (C) Copyright Noel Belcourt 2007.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// PGI C++ compiler setup:
#define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__
#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
//
// Threading support:
// Turn this on unconditionally here, it will get turned off again later
// if no threading API is detected.
//
#if __PGIC__ >= 11
// options requested by configure --enable-test
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_THREADS
#define BOOST_HAS_PTHREAD_YIELD
#define BOOST_HAS_NRVO
#define BOOST_HAS_LONG_LONG
// options --enable-test wants undefined
#undef BOOST_NO_STDC_NAMESPACE
#undef BOOST_NO_EXCEPTION_STD_NAMESPACE
#undef BOOST_DEDUCED_TYPENAME
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
#elif __PGIC__ >= 10
// options requested by configure --enable-test
#define BOOST_HAS_THREADS
#define BOOST_HAS_NRVO
#define BOOST_HAS_LONG_LONG
#if defined(linux) || defined(__linux) || defined(__linux__)
# define BOOST_HAS_STDINT_H
#endif
// options --enable-test wants undefined
#undef BOOST_NO_STDC_NAMESPACE
#undef BOOST_NO_EXCEPTION_STD_NAMESPACE
#undef BOOST_DEDUCED_TYPENAME
#elif __PGIC__ >= 7
#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#define BOOST_NO_TWO_PHASE_NAME_LOOKUP
#define BOOST_NO_SWPRINTF
#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
#define BOOST_NO_CXX11_AUTO_DECLARATIONS
#else
# error "Pgi compiler not configured - please reconfigure"
#endif
//
// C++0x features
//
// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG
//
#define BOOST_NO_CXX11_CHAR16_T
#define BOOST_NO_CXX11_CHAR32_T
#define BOOST_NO_CXX11_CONSTEXPR
#define BOOST_NO_CXX11_DECLTYPE
#define BOOST_NO_CXX11_DECLTYPE_N3276
#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
#define BOOST_NO_CXX11_DELETED_FUNCTIONS
#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_NO_CXX11_EXTERN_TEMPLATE
#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#define BOOST_NO_CXX11_LAMBDAS
#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_NULLPTR
#define BOOST_NO_CXX11_NUMERIC_LIMITS
#define BOOST_NO_CXX11_RANGE_BASED_FOR
#define BOOST_NO_CXX11_RAW_LITERALS
#define BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_NO_CXX11_SCOPED_ENUMS
#define BOOST_NO_SFINAE_EXPR
#define BOOST_NO_CXX11_STATIC_ASSERT
#define BOOST_NO_SWPRINTF
#define BOOST_NO_CXX11_TEMPLATE_ALIASES
#define BOOST_NO_CXX11_UNICODE_LITERALS
#define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#define BOOST_NO_CXX11_VARIADIC_MACROS
#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#define BOOST_NO_CXX11_HDR_UNORDERED_SET
#define BOOST_NO_CXX11_HDR_UNORDERED_MAP
#define BOOST_NO_CXX11_HDR_TYPEINDEX
#define BOOST_NO_CXX11_HDR_TYPE_TRAITS
#define BOOST_NO_CXX11_HDR_TUPLE
#define BOOST_NO_CXX11_HDR_THREAD
#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
#define BOOST_NO_CXX11_HDR_REGEX
#define BOOST_NO_CXX11_HDR_RATIO
#define BOOST_NO_CXX11_HDR_RANDOM
#define BOOST_NO_CXX11_HDR_MUTEX
#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#define BOOST_NO_CXX11_HDR_FUTURE
#define BOOST_NO_CXX11_HDR_FORWARD_LIST
#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
#define BOOST_NO_CXX11_HDR_CODECVT
#define BOOST_NO_CXX11_HDR_CHRONO
#define BOOST_NO_CXX11_HDR_ARRAY
#define BOOST_NO_CXX11_USER_DEFINED_LITERALS
#define BOOST_NO_CXX11_ALIGNAS
#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#define BOOST_NO_CXX11_INLINE_NAMESPACES
#define BOOST_NO_CXX11_REF_QUALIFIERS
#define BOOST_NO_CXX11_FINAL
#define BOOST_NO_CXX11_THREAD_LOCAL
// C++ 14:
#if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304)
# define BOOST_NO_CXX14_AGGREGATE_NSDMI
#endif
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
# define BOOST_NO_CXX14_BINARY_LITERALS
#endif
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
# define BOOST_NO_CXX14_CONSTEXPR
#endif
#if !defined(__cpp_decltype_auto) || (__cpp_decltype_auto < 201304)
# define BOOST_NO_CXX14_DECLTYPE_AUTO
#endif
#if (__cplusplus < 201304) // There's no SD6 check for this....
# define BOOST_NO_CXX14_DIGIT_SEPARATORS
#endif
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
# define BOOST_NO_CXX14_GENERIC_LAMBDAS
#endif
#if !defined(__cpp_init_captures) || (__cpp_init_captures < 201304)
# define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#endif
#if !defined(__cpp_return_type_deduction) || (__cpp_return_type_deduction < 201304)
# define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
# define BOOST_NO_CXX14_VARIABLE_TEMPLATES
#endif
//
// version check:
// probably nothing to do here?
@@ -0,0 +1,119 @@
// Copyright Aleksey Gurtovoy 2000-2008
//
// 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)
//
// *Preprocessed* version of the main "quote.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template< typename T, bool has_type_ >
struct quote_impl
{
typedef typename T::type type;
};
template< typename T >
struct quote_impl< T,false >
{
typedef T type;
};
template<
template< typename P1 > class F
, typename Tag = void_
>
struct quote1
{
template< typename U1 > struct apply
{
typedef typename quote_impl<
F<U1>
, aux::has_type< F<U1> >::value
>::type type;
};
};
template<
template< typename P1, typename P2 > class F
, typename Tag = void_
>
struct quote2
{
template< typename U1, typename U2 > struct apply
{
typedef typename quote_impl<
F< U1,U2 >
, aux::has_type< F< U1,U2 > >::value
>::type type;
};
};
template<
template< typename P1, typename P2, typename P3 > class F
, typename Tag = void_
>
struct quote3
{
template< typename U1, typename U2, typename U3 > struct apply
{
typedef typename quote_impl<
F< U1,U2,U3 >
, aux::has_type< F< U1,U2,U3 > >::value
>::type type;
};
};
template<
template< typename P1, typename P2, typename P3, typename P4 > class F
, typename Tag = void_
>
struct quote4
{
template<
typename U1, typename U2, typename U3, typename U4
>
struct apply
{
typedef typename quote_impl<
F< U1,U2,U3,U4 >
, aux::has_type< F< U1,U2,U3,U4 > >::value
>::type type;
};
};
template<
template<
typename P1, typename P2, typename P3, typename P4
, typename P5
>
class F
, typename Tag = void_
>
struct quote5
{
template<
typename U1, typename U2, typename U3, typename U4
, typename U5
>
struct apply
{
typedef typename quote_impl<
F< U1,U2,U3,U4,U5 >
, aux::has_type< F< U1,U2,U3,U4,U5 > >::value
>::type type;
};
};
}}
@@ -0,0 +1,593 @@
// (C) Copyright Howard Hinnant
// (C) Copyright 2011 Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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_CHRONO_IO_DURATION_GET_HPP
#define BOOST_CHRONO_IO_DURATION_GET_HPP
#include <boost/chrono/config.hpp>
#include <string>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/mpl/if.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/chrono/detail/scan_keyword.hpp>
#include <boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/assert.hpp>
#include <locale>
/**
* Duration formatting facet for input.
*/
namespace boost
{
namespace chrono
{
namespace detail
{
template <class Rep, bool = is_scalar<Rep>::value>
struct duration_io_intermediate
{
typedef Rep type;
};
template <class Rep>
struct duration_io_intermediate<Rep, true>
{
typedef typename mpl::if_c<is_floating_point<Rep>::value, long double, typename mpl::if_c<
is_signed<Rep>::value, long long, unsigned long long>::type>::type type;
};
template <class Rep>
struct duration_io_intermediate<process_times<Rep>, false>
{
typedef process_times<typename duration_io_intermediate<Rep>::type> type;
};
template <typename intermediate_type>
typename enable_if<is_integral<intermediate_type> , bool>::type reduce(intermediate_type& r,
unsigned long long& den, std::ios_base::iostate& err)
{
typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
// Reduce r * num / den
common_type_t t = integer::gcd<common_type_t>(common_type_t(r), common_type_t(den));
r /= t;
den /= t;
if (den != 1)
{
// Conversion to Period is integral and not exact
err |= std::ios_base::failbit;
return false;
}
return true;
}
template <typename intermediate_type>
typename disable_if<is_integral<intermediate_type> , bool>::type reduce(intermediate_type&, unsigned long long&,
std::ios_base::iostate&)
{
return true;
}
}
/**
* @c duration_get is used to parse a character sequence, extracting
* components of a duration into a class duration.
* Each get member parses a format as produced by a corresponding format specifier to time_put<>::put.
* If the sequence being parsed matches the correct format, the
* corresponding member of the class duration argument are set to the
* value used to produce the sequence;
* otherwise either an error is reported or unspecified values are assigned.
* In other words, user confirmation is required for reliable parsing of
* user-entered durations, but machine-generated formats can be parsed
* reliably. This allows parsers to be aggressive about interpreting user
* variations on standard formats.
*
* If the end iterator is reached during parsing of the get() member
* function, the member sets std::ios_base::eofbit in err.
*/
template <class CharT, class InputIterator = std::istreambuf_iterator<CharT> >
class duration_get: public std::locale::facet
{
public:
/**
* Type of character the facet is instantiated on.
*/
typedef CharT char_type;
/**
* Type of character string passed to member functions.
*/
typedef std::basic_string<CharT> string_type;
/**
* Type of iterator used to scan the character buffer.
*/
typedef InputIterator iter_type;
/**
* Construct a @c duration_get facet.
* @param refs
* @Effects Construct a @c duration_get facet.
* If the @c refs argument is @c 0 then destruction of the object is
* delegated to the @c locale, or locales, containing it. This allows
* the user to ignore lifetime management issues. On the other had,
* if @c refs is @c 1 then the object must be explicitly deleted;
* the @c locale will not do so. In this case, the object can be
* maintained across the lifetime of multiple locales.
*/
explicit duration_get(size_t refs = 0) :
std::locale::facet(refs)
{
}
/**
* @param s start input stream iterator
* @param end end input stream iterator
* @param ios a reference to a ios_base
* @param err the ios_base state
* @param d the duration
* @param pattern begin of the formatting pattern
* @param pat_end end of the formatting pattern
*
* Requires: [pattern,pat_end) shall be a valid range.
*
* Effects: The function starts by evaluating err = std::ios_base::goodbit.
* It then enters a loop, reading zero or more characters from s at
* each iteration. Unless otherwise specified below, the loop
* terminates when the first of the following conditions holds:
* - The expression pattern == pat_end evaluates to true.
* - The expression err == std::ios_base::goodbit evaluates to false.
* - The expression s == end evaluates to true, in which case the
* function evaluates err = std::ios_base::eofbit | std::ios_base::failbit.
* - The next element of pattern is equal to '%', followed by a conversion
* specifier character, format.
* If the number of elements in the range [pattern,pat_end) is not
* sufficient to unambiguously determine whether the conversion
* specification is complete and valid, the function evaluates
* err = std::ios_base::failbit. Otherwise, the function evaluates
* s = get_value(s, end, ios, err, r) when the conversion specification is 'v' and
* s = get_value(s, end, ios, err, rt) when the conversion specification is 'u'.
* If err == std::ios_base::goodbit holds after
* the evaluation of the expression, the function increments pattern to
* point just past the end of the conversion specification and continues
* looping.
* - The expression isspace(*pattern, ios.getloc()) evaluates to true, in
* which case the function first increments pattern until
* pattern == pat_end || !isspace(*pattern, ios.getloc()) evaluates to true,
* then advances s until s == end || !isspace(*s, ios.getloc()) is true,
* and finally resumes looping.
* - The next character read from s matches the element pointed to by
* pattern in a case-insensitive comparison, in which case the function
* evaluates ++pattern, ++s and continues looping. Otherwise, the function
* evaluates err = std::ios_base::failbit.
*
* Once r and rt are retrieved,
* Returns: s
*/
template <typename Rep, typename Period>
iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err,
duration<Rep, Period> &d, const char_type *pattern, const char_type *pat_end) const
{
if (std::has_facet<duration_units<CharT> >(ios.getloc()))
{
duration_units<CharT> const&facet = std::use_facet<duration_units<CharT> >(ios.getloc());
return get(facet, s, end, ios, err, d, pattern, pat_end);
}
else
{
duration_units_default<CharT> facet;
return get(facet, s, end, ios, err, d, pattern, pat_end);
}
}
template <typename Rep, typename Period>
iter_type get(duration_units<CharT> const&facet, iter_type s, iter_type end, std::ios_base& ios,
std::ios_base::iostate& err, duration<Rep, Period> &d, const char_type *pattern, const char_type *pat_end) const
{
typedef typename detail::duration_io_intermediate<Rep>::type intermediate_type;
intermediate_type r;
rt_ratio rt;
bool value_found = false, unit_found = false;
const std::ctype<char_type>& ct = std::use_facet<std::ctype<char_type> >(ios.getloc());
while (pattern != pat_end && err == std::ios_base::goodbit)
{
if (s == end)
{
err |= std::ios_base::eofbit;
break;
}
if (ct.narrow(*pattern, 0) == '%')
{
if (++pattern == pat_end)
{
err |= std::ios_base::failbit;
return s;
}
char cmd = ct.narrow(*pattern, 0);
switch (cmd)
{
case 'v':
{
if (value_found)
{
err |= std::ios_base::failbit;
return s;
}
value_found = true;
s = get_value(s, end, ios, err, r);
if (err & (std::ios_base::badbit | std::ios_base::failbit))
{
return s;
}
break;
}
case 'u':
{
if (unit_found)
{
err |= std::ios_base::failbit;
return s;
}
unit_found = true;
s = get_unit(facet, s, end, ios, err, rt);
if (err & (std::ios_base::badbit | std::ios_base::failbit))
{
return s;
}
break;
}
default:
BOOST_ASSERT(false && "Boost::Chrono internal error.");
break;
}
++pattern;
}
else if (ct.is(std::ctype_base::space, *pattern))
{
for (++pattern; pattern != pat_end && ct.is(std::ctype_base::space, *pattern); ++pattern)
;
for (; s != end && ct.is(std::ctype_base::space, *s); ++s)
;
}
else if (ct.toupper(*s) == ct.toupper(*pattern))
{
++s;
++pattern;
}
else
{
err |= std::ios_base::failbit;
return s;
}
}
unsigned long long num = rt.num;
unsigned long long den = rt.den;
// r should be multiplied by (num/den) / Period
// Reduce (num/den) / Period to lowest terms
unsigned long long gcd_n1_n2 = integer::gcd<unsigned long long>(num, Period::num);
unsigned long long gcd_d1_d2 = integer::gcd<unsigned long long>(den, Period::den);
num /= gcd_n1_n2;
den /= gcd_d1_d2;
unsigned long long n2 = Period::num / gcd_n1_n2;
unsigned long long d2 = Period::den / gcd_d1_d2;
if (num > (std::numeric_limits<unsigned long long>::max)() / d2 || den
> (std::numeric_limits<unsigned long long>::max)() / n2)
{
// (num/den) / Period overflows
err |= std::ios_base::failbit;
return s;
}
num *= d2;
den *= n2;
typedef typename common_type<intermediate_type, unsigned long long>::type common_type_t;
// num / den is now factor to multiply by r
if (!detail::reduce(r, den, err)) return s;
if (chrono::detail::gt(r, ( (duration_values<common_type_t>::max)() / num)))
{
// Conversion to Period overflowed
err |= std::ios_base::failbit;
return s;
}
common_type_t t = r * num;
t /= den;
if (t > duration_values<common_type_t>::zero())
{
Rep pt = t;
if ( (duration_values<Rep>::max)() < pt)
{
// Conversion to Period overflowed
err |= std::ios_base::failbit;
return s;
}
}
// Success! Store it.
r = Rep(t);
d = duration<Rep, Period> (r);
return s;
}
/**
*
* @param s start input stream iterator
* @param end end input stream iterator
* @param ios a reference to a ios_base
* @param err the ios_base state
* @param d the duration
* Stores the duration pattern from the @c duration_unit facet in let say @c str. Last as if
* @code
* return get(s, end, ios, err, ios, d, str.data(), str.data() + str.size());
* @codeend
* @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name
*/
template <typename Rep, typename Period>
iter_type get(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err,
duration<Rep, Period> & d) const
{
if (std::has_facet<duration_units<CharT> >(ios.getloc()))
{
duration_units<CharT> const&facet = std::use_facet<duration_units<CharT> >(ios.getloc());
std::basic_string<CharT> str = facet.get_pattern();
return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size());
}
else
{
duration_units_default<CharT> facet;
std::basic_string<CharT> str = facet.get_pattern();
return get(facet, s, end, ios, err, d, str.data(), str.data() + str.size());
}
}
/**
*
* @param s start input stream iterator
* @param end end input stream iterator
* @param ios a reference to a ios_base
* @param err the ios_base state
* @param r a reference to the duration representation.
* @Effects As if
* @code
* return std::use_facet<std::num_get<cahr_type, iter_type> >(ios.getloc()).get(s, end, ios, err, r);
* @endcode
*
* @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name
*/
template <typename Rep>
iter_type get_value(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, Rep& r) const
{
return std::use_facet<std::num_get<CharT, iter_type> >(ios.getloc()).get(s, end, ios, err, r);
}
template <typename Rep>
iter_type get_value(iter_type s, iter_type end, std::ios_base& ios, std::ios_base::iostate& err, process_times<Rep>& r) const
{
if (s == end) {
err |= std::ios_base::eofbit;
return s;
} else if (*s != '{') { // mandatory '{'
err |= std::ios_base::failbit;
return s;
}
++s;
s = std::use_facet<std::num_get<CharT, iter_type> >(ios.getloc()).get(s, end, ios, err, r.real);
if (s == end) {
err |= std::ios_base::eofbit;
return s;
} else if (*s != ';') { // mandatory ';'
err |= std::ios_base::failbit;
return s;
}
++s;
s = std::use_facet<std::num_get<CharT, iter_type> >(ios.getloc()).get(s, end, ios, err, r.user);
if (s == end) {
err |= std::ios_base::eofbit;
return s;
} else if (*s != ';') { // mandatory ';'
err |= std::ios_base::failbit;
return s;
}
++s;
s = std::use_facet<std::num_get<CharT, iter_type> >(ios.getloc()).get(s, end, ios, err, r.system);
if (s == end) {
err |= std::ios_base::eofbit;
return s;
} else if (*s != '}') { // mandatory '}'
err |= std::ios_base::failbit;
return s;
}
return s;
}
/**
*
* @param s start input stream iterator
* @param e end input stream iterator
* @param ios a reference to a ios_base
* @param err the ios_base state
* @param rt a reference to the duration run-time ratio.
* @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name
*/
iter_type get_unit(iter_type i, iter_type e, std::ios_base& is, std::ios_base::iostate& err, rt_ratio &rt) const
{
if (std::has_facet<duration_units<CharT> >(is.getloc()))
{
return get_unit(std::use_facet<duration_units<CharT> >(is.getloc()), i, e, is, err, rt);
}
else
{
duration_units_default<CharT> facet;
return get_unit(facet, i, e, is, err, rt);
}
}
iter_type get_unit(duration_units<CharT> const &facet, iter_type i, iter_type e, std::ios_base& is,
std::ios_base::iostate& err, rt_ratio &rt) const
{
if (*i == '[')
{
// parse [N/D]s or [N/D]second or [N/D]seconds format
++i;
i = std::use_facet<std::num_get<CharT, iter_type> >(is.getloc()).get(i, e, is, err, rt.num);
if ( (err & std::ios_base::failbit) != 0)
{
return i;
}
if (i == e)
{
err |= std::ios_base::failbit;
return i;
}
CharT x = *i++;
if (x != '/')
{
err |= std::ios_base::failbit;
return i;
}
i = std::use_facet<std::num_get<CharT, iter_type> >(is.getloc()).get(i, e, is, err, rt.den);
if ( (err & std::ios_base::failbit) != 0)
{
return i;
}
if (i == e)
{
err |= std::ios_base::failbit;
return i;
}
if (*i != ']')
{
err |= std::ios_base::failbit;
return i;
}
++i;
if (i == e)
{
err |= std::ios_base::failbit;
return i;
}
// parse s or second or seconds
return do_get_n_d_valid_unit(facet, i, e, is, err);
}
else
{
return do_get_valid_unit(facet, i, e, is, err, rt);
}
}
/**
* Unique identifier for this type of facet.
*/
static std::locale::id id;
/**
* @Effects Destroy the facet
*/
~duration_get()
{
}
protected:
/**
* Extracts the run-time ratio associated to the duration when it is given in prefix form.
*
* This is an extension point of this facet so that we can take in account other periods that can have a useful
* translation in other contexts, as e.g. days and weeks.
*
* @param facet the duration_units facet
* @param i start input stream iterator.
* @param e end input stream iterator.
* @param ios a reference to a ios_base.
* @param err the ios_base state.
* @return @c s
*/
iter_type do_get_n_d_valid_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
std::ios_base&, std::ios_base::iostate& err) const
{
// parse SI name, short or long
const string_type* units = facet.get_n_d_valid_units_start();
const string_type* units_end = facet.get_n_d_valid_units_end();
const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
//~ std::use_facet<std::ctype<CharT> >(loc),
err);
if (err & (std::ios_base::badbit | std::ios_base::failbit))
{
return i;
}
if (!facet.match_n_d_valid_unit(k))
{
err |= std::ios_base::failbit;
}
return i;
}
/**
* Extracts the run-time ratio associated to the duration when it is given in prefix form.
*
* This is an extension point of this facet so that we can take in account other periods that can have a useful
* translation in other contexts, as e.g. days and weeks.
*
* @param facet the duration_units facet
* @param i start input stream iterator.
* @param e end input stream iterator.
* @param ios a reference to a ios_base.
* @param err the ios_base state.
* @param rt a reference to the duration run-time ratio.
* @Effects
* @Returns An iterator pointing just beyond the last character that can be determined to be part of a valid name.
*/
iter_type do_get_valid_unit(duration_units<CharT> const &facet, iter_type i, iter_type e,
std::ios_base&, std::ios_base::iostate& err, rt_ratio &rt) const
{
// parse SI name, short or long
const string_type* units = facet.get_valid_units_start();
const string_type* units_end = facet.get_valid_units_end();
err = std::ios_base::goodbit;
const string_type* k = chrono_detail::scan_keyword(i, e, units, units_end,
//~ std::use_facet<std::ctype<CharT> >(loc),
err);
if (err & (std::ios_base::badbit | std::ios_base::failbit))
{
return i;
}
if (!facet.match_valid_unit(k, rt))
{
err |= std::ios_base::failbit;
}
return i;
}
};
/**
* Unique identifier for this type of facet.
*/
template <class CharT, class InputIterator>
std::locale::id duration_get<CharT, InputIterator>::id;
} // chrono
}
// boost
#endif // header
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,169 @@
#ifndef _DATE_TIME_WRAPPING_INT_HPP__
#define _DATE_TIME_WRAPPING_INT_HPP__
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
namespace boost {
namespace date_time {
//! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type)
/*! In composite date and time types this type is used to
* wrap at the day boundary.
* Ex:
* A wrapping_int<short, 10> will roll over after nine, and
* roll under below zero. This gives a range of [0,9]
*
* NOTE: it is strongly recommended that wrapping_int2 be used
* instead of wrapping_int as wrapping_int is to be depricated
* at some point soon.
*
* Also Note that warnings will occur if instantiated with an
* unsigned type. Only a signed type should be used!
*/
template<typename int_type_, int_type_ wrap_val>
class wrapping_int {
public:
typedef int_type_ int_type;
//typedef overflow_type_ overflow_type;
static int_type wrap_value() {return wrap_val;}
//!Add, return true if wrapped
wrapping_int(int_type v) : value_(v) {}
//! Explicit converion method
int_type as_int() const {return value_;}
operator int_type() const {return value_;}
//!Add, return number of wraps performed
/*! The sign of the returned value will indicate which direction the
* wraps went. Ex: add a negative number and wrapping under could occur,
* this would be indicated by a negative return value. If wrapping over
* took place, a positive value would be returned */
template< typename IntT >
IntT add(IntT v)
{
int_type remainder = static_cast<int_type>(v % (wrap_val));
IntT overflow = static_cast<IntT>(v / (wrap_val));
value_ = static_cast<int_type>(value_ + remainder);
return calculate_wrap(overflow);
}
//! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps)
/*! The sign of the returned value will indicate which direction the
* wraps went (positive indicates wrap under, negative indicates wrap over).
* Ex: subtract a negative number and wrapping over could
* occur, this would be indicated by a negative return value. If
* wrapping under took place, a positive value would be returned. */
template< typename IntT >
IntT subtract(IntT v)
{
int_type remainder = static_cast<int_type>(v % (wrap_val));
IntT underflow = static_cast<IntT>(-(v / (wrap_val)));
value_ = static_cast<int_type>(value_ - remainder);
return calculate_wrap(underflow) * -1;
}
private:
int_type value_;
template< typename IntT >
IntT calculate_wrap(IntT wrap)
{
if ((value_) >= wrap_val)
{
++wrap;
value_ -= (wrap_val);
}
else if(value_ < 0)
{
--wrap;
value_ += (wrap_val);
}
return wrap;
}
};
//! A wrapping integer used to wrap around at the top (WARNING: only instantiate with a signed type)
/*! Bad name, quick impl to fix a bug -- fix later!!
* This allows the wrap to restart at a value other than 0.
*/
template<typename int_type_, int_type_ wrap_min, int_type_ wrap_max>
class wrapping_int2 {
public:
typedef int_type_ int_type;
static int_type wrap_value() {return wrap_max;}
static int_type min_value() {return wrap_min;}
/*! If initializing value is out of range of [wrap_min, wrap_max],
* value will be initialized to closest of min or max */
wrapping_int2(int_type v) : value_(v) {
if(value_ < wrap_min)
{
value_ = wrap_min;
}
if(value_ > wrap_max)
{
value_ = wrap_max;
}
}
//! Explicit converion method
int_type as_int() const {return value_;}
operator int_type() const {return value_;}
//!Add, return number of wraps performed
/*! The sign of the returned value will indicate which direction the
* wraps went. Ex: add a negative number and wrapping under could occur,
* this would be indicated by a negative return value. If wrapping over
* took place, a positive value would be returned */
template< typename IntT >
IntT add(IntT v)
{
int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1));
IntT overflow = static_cast<IntT>(v / (wrap_max - wrap_min + 1));
value_ = static_cast<int_type>(value_ + remainder);
return calculate_wrap(overflow);
}
//! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps)
/*! The sign of the returned value will indicate which direction the
* wraps went. Ex: subtract a negative number and wrapping over could
* occur, this would be indicated by a positive return value. If
* wrapping under took place, a negative value would be returned */
template< typename IntT >
IntT subtract(IntT v)
{
int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1));
IntT underflow = static_cast<IntT>(-(v / (wrap_max - wrap_min + 1)));
value_ = static_cast<int_type>(value_ - remainder);
return calculate_wrap(underflow);
}
private:
int_type value_;
template< typename IntT >
IntT calculate_wrap(IntT wrap)
{
if ((value_) > wrap_max)
{
++wrap;
value_ -= (wrap_max - wrap_min + 1);
}
else if((value_) < wrap_min)
{
--wrap;
value_ += (wrap_max - wrap_min + 1);
}
return wrap;
}
};
} } //namespace date_time
#endif
@@ -0,0 +1,33 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#ifndef BOOST_FT_IS_CALLABLE_BUILTIN_HPP_INCLUDED
#define BOOST_FT_IS_CALLABLE_BUILTIN_HPP_INCLUDED
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/function_types/components.hpp>
namespace boost
{
namespace function_types
{
template< typename T, typename Tag = null_tag >
struct is_callable_builtin
: function_types::represents
< function_types::components<T>
, function_types::tag<Tag, detail::callable_builtin_tag>
>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_callable_builtin,(T,Tag))
};
}
}
#endif
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
/* Boost interval/detail/x86gcc_rounding_control.hpp file
*
* Copyright 2000 Jens Maurer
* Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
*
* 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_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
#define BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP
#ifndef __GNUC__
# error This header only works with GNU CC.
#endif
#ifndef __i386__
# error This header only works on x86 CPUs.
#endif
namespace boost {
namespace numeric {
namespace interval_lib {
namespace detail {
struct x86_rounding
{
typedef unsigned short rounding_mode;
static void set_rounding_mode(const rounding_mode& mode)
{ __asm__ __volatile__ ("fldcw %0" : : "m"(mode)); }
static void get_rounding_mode(rounding_mode& mode)
{ __asm__ __volatile__ ("fnstcw %0" : "=m"(mode)); }
template<class T>
static T to_int(T r)
{
T r_;
__asm__ ("frndint" : "=&t"(r_) : "0"(r));
return r_;
}
};
} // namespace detail
} // namespace interval_lib
} // namespace numeric
} // namespace boost
#endif /* BOOST_NUMERIC_INTERVAL_DETAIL_X86GCC_ROUNDING_CONTROL_HPP */
@@ -0,0 +1,25 @@
#ifndef BOOST_MPL_AUX_LAMBDA_ARITY_PARAM_HPP_INCLUDED
#define BOOST_MPL_AUX_LAMBDA_ARITY_PARAM_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/config/ttp.hpp>
#if !defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
# define BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(param)
#else
# define BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(param) , param
#endif
#endif // BOOST_MPL_AUX_LAMBDA_ARITY_PARAM_HPP_INCLUDED
@@ -0,0 +1,52 @@
/*
Copyright Rene Rivera 2008-2015
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_PREDEF_LIBRARY_STD_DINKUMWARE_H
#define BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H
#include <boost/predef/library/std/_prefix.h>
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
/*`
[heading `BOOST_LIB_STD_DINKUMWARE`]
[@http://en.wikipedia.org/wiki/Dinkumware Dinkumware] Standard C++ Library.
If available version number as major, minor, and patch.
[table
[[__predef_symbol__] [__predef_version__]]
[[`_YVALS`, `__IBMCPP__`] [__predef_detection__]]
[[`_CPPLIB_VER`] [__predef_detection__]]
[[`_CPPLIB_VER`] [V.R.0]]
]
*/
#define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
# undef BOOST_LIB_STD_DINKUMWARE
# if defined(_CPPLIB_VER)
# define BOOST_LIB_STD_DINKUMWARE BOOST_PREDEF_MAKE_10_VVRR(_CPPLIB_VER)
# else
# define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_AVAILABLE
# endif
#endif
#if BOOST_LIB_STD_DINKUMWARE
# define BOOST_LIB_STD_DINKUMWARE_AVAILABLE
#endif
#define BOOST_LIB_STD_DINKUMWARE_NAME "Dinkumware"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_DINKUMWARE,BOOST_LIB_STD_DINKUMWARE_NAME)
@@ -0,0 +1,43 @@
// Copyright David Abrahams 2002.
// 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 MAP_ENTRY_DWA2002118_HPP
# define MAP_ENTRY_DWA2002118_HPP
namespace boost { namespace python { namespace detail {
// A trivial type that works well as the value_type of associative
// vector maps
template <class Key, class Value>
struct map_entry
{
map_entry() {}
map_entry(Key k) : key(k), value() {}
map_entry(Key k, Value v) : key(k), value(v) {}
bool operator<(map_entry const& rhs) const
{
return this->key < rhs.key;
}
Key key;
Value value;
};
template <class Key, class Value>
bool operator<(map_entry<Key,Value> const& e, Key const& k)
{
return e.key < k;
}
template <class Key, class Value>
bool operator<(Key const& k, map_entry<Key,Value> const& e)
{
return k < e.key;
}
}}} // namespace boost::python::detail
#endif // MAP_ENTRY_DWA2002118_HPP
@@ -0,0 +1,113 @@
/* Boost interval/compare/certain.hpp template implementation file
*
* Copyright 2003 Guillaume Melquiond
*
* 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_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP
#define BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP
#include <boost/numeric/interval/detail/interval_prototype.hpp>
#include <boost/numeric/interval/detail/test_input.hpp>
namespace boost {
namespace numeric {
namespace interval_lib {
namespace compare {
namespace certain {
template<class T, class Policies1, class Policies2> inline
bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() < y.lower();
}
template<class T, class Policies> inline
bool operator<(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() < y;
}
template<class T, class Policies1, class Policies2> inline
bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() <= y.lower();
}
template<class T, class Policies> inline
bool operator<=(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() <= y;
}
template<class T, class Policies1, class Policies2> inline
bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.lower() > y.upper();
}
template<class T, class Policies> inline
bool operator>(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.lower() > y;
}
template<class T, class Policies1, class Policies2> inline
bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.lower() >= y.upper();
}
template<class T, class Policies> inline
bool operator>=(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.lower() >= y;
}
template<class T, class Policies1, class Policies2> inline
bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() == y.lower() && x.lower() == y.upper();
}
template<class T, class Policies> inline
bool operator==(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() == y && x.lower() == y;
}
template<class T, class Policies1, class Policies2> inline
bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() < y.lower() || x.lower() > y.upper();
}
template<class T, class Policies> inline
bool operator!=(const interval<T, Policies>& x, const T& y)
{
if (detail::test_input(x, y)) throw comparison_error();
return x.upper() < y || x.lower() > y;
}
} // namespace certain
} // namespace compare
} // namespace interval_lib
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP
@@ -0,0 +1,104 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002-2011. *
# * (C) Copyright Edward Diener 2011. *
# * Distributed under the Boost Software License, Version 1.0. (See *
# * accompanying file LICENSE_1_0.txt or copy at *
# * http://www.boost.org/LICENSE_1_0.txt) *
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_CONFIG_CONFIG_HPP
# define BOOST_PREPROCESSOR_CONFIG_CONFIG_HPP
#
# /* BOOST_PP_CONFIG_FLAGS */
#
# define BOOST_PP_CONFIG_STRICT() 0x0001
# define BOOST_PP_CONFIG_IDEAL() 0x0002
#
# define BOOST_PP_CONFIG_MSVC() 0x0004
# define BOOST_PP_CONFIG_MWCC() 0x0008
# define BOOST_PP_CONFIG_BCC() 0x0010
# define BOOST_PP_CONFIG_EDG() 0x0020
# define BOOST_PP_CONFIG_DMC() 0x0040
#
# ifndef BOOST_PP_CONFIG_FLAGS
# if defined(__GCCXML__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__WAVE__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__EDG__) || defined(__EDG_VERSION__)
# if defined(_MSC_VER) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT())
# endif
# elif defined(__MWERKS__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MWCC())
# elif defined(__DMC__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_DMC())
# elif defined(__BORLANDC__) && __BORLANDC__ >= 0x581
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_BCC())
# elif defined(_MSC_VER) && !defined(__clang__)
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC())
# else
# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT())
# endif
# endif
#
# /* BOOST_PP_CONFIG_EXTENDED_LINE_INFO */
#
# ifndef BOOST_PP_CONFIG_EXTENDED_LINE_INFO
# define BOOST_PP_CONFIG_EXTENDED_LINE_INFO 0
# endif
#
# /* BOOST_PP_CONFIG_ERRORS */
#
# ifndef BOOST_PP_CONFIG_ERRORS
# ifdef NDEBUG
# define BOOST_PP_CONFIG_ERRORS 0
# else
# define BOOST_PP_CONFIG_ERRORS 1
# endif
# endif
#
# /* BOOST_PP_VARIADICS */
#
# define BOOST_PP_VARIADICS_MSVC 0
# if !defined BOOST_PP_VARIADICS
# /* variadic support explicitly disabled for all untested compilers */
# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI
# define BOOST_PP_VARIADICS 0
# /* VC++ (C/C++) */
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__
# define BOOST_PP_VARIADICS 1
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
# /* Wave (C/C++), GCC (C++) */
# elif defined __WAVE__ && __WAVE_HAS_VARIADICS__ || defined __GNUC__ && defined __GXX_EXPERIMENTAL_CXX0X__ && __GXX_EXPERIMENTAL_CXX0X__
# define BOOST_PP_VARIADICS 1
# /* EDG-based (C/C++), GCC (C), and unknown (C/C++) */
# elif !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
# define BOOST_PP_VARIADICS 1
# else
# define BOOST_PP_VARIADICS 0
# endif
# elif !BOOST_PP_VARIADICS + 1 < 2
# undef BOOST_PP_VARIADICS
# define BOOST_PP_VARIADICS 1
# if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
# undef BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADICS_MSVC 1
# endif
# else
# undef BOOST_PP_VARIADICS
# define BOOST_PP_VARIADICS 0
# endif
#
# endif
@@ -0,0 +1,183 @@
/*
[auto_generated]
boost/numeric/odeint/iterator/adaptive_iterator.hpp
[begin_description]
Iterator for iterating throught the solution of an ODE with adaptive step size. The dereferenced types containes also the time.
[end_description]
Copyright 2012-2013 Karsten Ahnert
Copyright 2012 Mario Mulansky
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_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED
#include <boost/numeric/odeint/util/stepper_traits.hpp>
#include <boost/numeric/odeint/util/unit_helper.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/stepper/controlled_step_result.hpp>
#include <boost/numeric/odeint/iterator/impl/adaptive_iterator_impl.hpp>
namespace boost {
namespace numeric {
namespace odeint {
/* use the adaptive_iterator_impl with the right tags */
template< class Stepper , class System , class State
#ifndef DOXYGEN_SKIP
, class StepperTag = typename base_tag< typename traits::stepper_category< Stepper >::type >::type
#endif
>
class adaptive_iterator : public adaptive_iterator_impl<
adaptive_iterator< Stepper , System , State , StepperTag > ,
Stepper , System , State , detail::ode_state_iterator_tag , StepperTag
>
{
typedef typename traits::time_type< Stepper >::type time_type;
typedef adaptive_iterator< Stepper , System , State , StepperTag > iterator_type;
public:
adaptive_iterator( Stepper stepper , System sys , State &s , time_type t_start , time_type t_end , time_type dt )
: adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s , t_start , t_end , dt )
{}
adaptive_iterator( Stepper stepper , System sys , State &s )
: adaptive_iterator_impl< iterator_type , Stepper , System , State , detail::ode_state_iterator_tag , StepperTag >( stepper , sys , s )
{}
};
template< class Stepper , class System , class State >
adaptive_iterator< Stepper , System , State > make_adaptive_iterator_begin(
Stepper stepper ,
System system ,
State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
{
return adaptive_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt );
}
template< class Stepper , class System , class State >
adaptive_iterator< Stepper , System , State > make_adaptive_iterator_end(
Stepper stepper ,
System system ,
State &x )
{
return adaptive_iterator< Stepper , System , State >( stepper , system , x );
}
template< class Stepper , class System , class State >
std::pair< adaptive_iterator< Stepper , System , State > , adaptive_iterator< Stepper , System , State > >
make_adaptive_range(
Stepper stepper ,
System system ,
State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
{
return std::make_pair(
adaptive_iterator< Stepper , System , State >( stepper , system , x , t_start , t_end , dt ) ,
adaptive_iterator< Stepper , System , State >( stepper , system , x )
);
}
/**
* \class adaptive_iterator
*
* \brief ODE Iterator with adaptive step size. The value type of this iterator is the state type of the stepper.
*
* Implements an iterator representing the solution of an ODE from t_start
* to t_end evaluated at steps with an adaptive step size dt.
* After each iteration the iterator dereferences to the state x at the next
* time t+dt where dt is controlled by the stepper.
* This iterator can be used with ControlledSteppers and
* DenseOutputSteppers and it always makes use of the all the given steppers
* capabilities. A for_each over such an iterator range behaves similar to
* the integrate_adaptive routine.
*
* adaptive_iterator is a model of single-pass iterator.
*
* The value type of this iterator is the state type of the stepper. Hence one can only access the state and not the current time.
*
* \tparam Stepper The stepper type which should be used during the iteration.
* \tparam System The type of the system function (ODE) which should be solved.
* \tparam State The state type of the ODE.
*/
/**
* \fn make_adaptive_iterator_begin( Stepper stepper , System system , State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
*
* \brief Factory function for adaptive_iterator. Constructs a begin iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state.
* \param t_start The initial time.
* \param t_end The end time, at which the iteration should stop.
* \param dt The initial time step.
* \returns The adaptive iterator.
*/
/**
* \fn make_adaptive_iterator_end( Stepper stepper , System system , State &x )
* \brief Factory function for adaptive_iterator. Constructs a end iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state.
* \returns The adaptive iterator.
*/
/**
* \fn make_adaptive_range( Stepper stepper , System system , State &x ,
typename traits::time_type< Stepper >::type t_start ,
typename traits::time_type< Stepper >::type t_end ,
typename traits::time_type< Stepper >::type dt )
*
* \brief Factory function to construct a single pass range of adaptive iterators. A range is here a pair of adaptive_iterator.
*
* \param stepper The stepper to use during the iteration.
* \param system The system function (ODE) to solve.
* \param x The initial state.
* \param t_start The initial time.
* \param t_end The end time, at which the iteration should stop.
* \param dt The initial time step.
* \returns The adaptive range.
*/
} // namespace odeint
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_ODEINT_ITERATOR_ADAPTIVE_ITERATOR_HPP_INCLUDED
@@ -0,0 +1,65 @@
// Copyright David Abrahams 2002.
// Copyright Stefan Seefeld 2016.
// 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_python_converter_shared_ptr_from_python_hpp_
#define boost_python_converter_shared_ptr_from_python_hpp_
#include <boost/python/handle.hpp>
#include <boost/python/converter/shared_ptr_deleter.hpp>
#include <boost/python/converter/from_python.hpp>
#include <boost/python/converter/rvalue_from_python_data.hpp>
#include <boost/python/converter/registered.hpp>
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
# include <boost/python/converter/pytype_function.hpp>
#endif
#include <boost/shared_ptr.hpp>
#include <memory>
namespace boost { namespace python { namespace converter {
template <class T, template <typename> class SP>
struct shared_ptr_from_python
{
shared_ptr_from_python()
{
converter::registry::insert(&convertible, &construct, type_id<SP<T> >()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
, &converter::expected_from_python_type_direct<T>::get_pytype
#endif
);
}
private:
static void* convertible(PyObject* p)
{
if (p == Py_None)
return p;
return converter::get_lvalue_from_python(p, registered<T>::converters);
}
static void construct(PyObject* source, rvalue_from_python_stage1_data* data)
{
void* const storage = ((converter::rvalue_from_python_storage<SP<T> >*)data)->storage.bytes;
// Deal with the "None" case.
if (data->convertible == source)
new (storage) SP<T>();
else
{
SP<void> hold_convertible_ref_count(
(void*)0, shared_ptr_deleter(handle<>(borrowed(source))) );
// use aliasing constructor
new (storage) SP<T>(hold_convertible_ref_count,
static_cast<T*>(data->convertible));
}
data->convertible = storage;
}
};
}}} // namespace boost::python::converter
#endif
@@ -0,0 +1,130 @@
#include "DecodesModel.hpp"
#include <QStandardItem>
#include <QModelIndex>
#include <QTime>
#include <QString>
#include <QFont>
#include <QList>
namespace
{
char const * const headings[] = {
QT_TRANSLATE_NOOP ("DecodesModel", "Client"),
QT_TRANSLATE_NOOP ("DecodesModel", "Time"),
QT_TRANSLATE_NOOP ("DecodesModel", "Snr"),
QT_TRANSLATE_NOOP ("DecodesModel", "DT"),
QT_TRANSLATE_NOOP ("DecodesModel", "DF"),
QT_TRANSLATE_NOOP ("DecodesModel", "Md"),
QT_TRANSLATE_NOOP ("DecodesModel", "Message"),
};
QFont text_font {"Courier", 10};
QList<QStandardItem *> make_row (QString const& client_id, QTime time, qint32 snr, float delta_time
, quint32 delta_frequency, QString const& mode, QString const& message
, bool is_fast)
{
auto time_item = new QStandardItem {time.toString (is_fast ? "hh:mm:ss" : "hh:mm")};
time_item->setData (time);
time_item->setTextAlignment (Qt::AlignRight);
auto snr_item = new QStandardItem {QString::number (snr)};
snr_item->setData (snr);
snr_item->setTextAlignment (Qt::AlignRight);
auto dt = new QStandardItem {QString::number (delta_time)};
dt->setData (delta_time);
dt->setTextAlignment (Qt::AlignRight);
auto df = new QStandardItem {QString::number (delta_frequency)};
df->setData (delta_frequency);
df->setTextAlignment (Qt::AlignRight);
auto md = new QStandardItem {mode};
md->setTextAlignment (Qt::AlignHCenter);
QList<QStandardItem *> row {
new QStandardItem {client_id}, time_item, snr_item, dt, df, md, new QStandardItem {message}};
Q_FOREACH (auto& item, row)
{
item->setEditable (false);
item->setFont (text_font);
item->setTextAlignment (item->textAlignment () | Qt::AlignVCenter);
}
return row;
}
}
DecodesModel::DecodesModel (QObject * parent)
: QStandardItemModel {0, 7, parent}
{
int column {0};
for (auto const& heading : headings)
{
setHeaderData (column++, Qt::Horizontal, tr (heading));
}
}
void DecodesModel::add_decode (bool is_new, QString const& client_id, QTime time, qint32 snr, float delta_time
, quint32 delta_frequency, QString const& mode, QString const& message
, bool is_fast)
{
if (!is_new)
{
int target_row {-1};
for (auto row = 0; row < rowCount (); ++row)
{
if (data (index (row, 0)).toString () == client_id)
{
auto row_time = item (row, 1)->data ().toTime ();
if (row_time == time
&& item (row, 2)->data ().toInt () == snr
&& item (row, 3)->data ().toFloat () == delta_time
&& item (row, 4)->data ().toUInt () == delta_frequency
&& data (index (row, 5)).toString () == mode
&& data (index (row, 6)).toString () == message)
{
return;
}
if (time <= row_time)
{
target_row = row; // last row with same time
}
}
}
if (target_row >= 0)
{
insertRow (target_row + 1, make_row (client_id, time, snr, delta_time, delta_frequency, mode
, message, is_fast));
return;
}
}
appendRow (make_row (client_id, time, snr, delta_time, delta_frequency, mode, message, is_fast));
}
void DecodesModel::clear_decodes (QString const& client_id)
{
for (auto row = rowCount () - 1; row >= 0; --row)
{
if (data (index (row, 0)).toString () == client_id)
{
removeRow (row);
}
}
}
void DecodesModel::do_reply (QModelIndex const& source)
{
auto row = source.row ();
Q_EMIT reply (data (index (row, 0)).toString ()
, item (row, 1)->data ().toTime ()
, item (row, 2)->data ().toInt ()
, item (row, 3)->data ().toFloat ()
, item (row, 4)->data ().toInt ()
, data (index (row, 5)).toString ()
, data (index (row, 6)).toString ());
}
#include "moc_DecodesModel.cpp"
@@ -0,0 +1,55 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to 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)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
#define BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
#include <boost/range/detail/common.hpp>
//////////////////////////////////////////////////////////////////////////////
// missing partial specialization workaround.
//////////////////////////////////////////////////////////////////////////////
namespace boost
{
namespace range_detail
{
template< typename T >
struct range_size_type_
{
template< typename C >
struct pts
{
typedef std::size_t type;
};
};
template<>
struct range_size_type_<std_container_>
{
template< typename C >
struct pts
{
typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
};
};
}
template< typename C >
class range_size
{
typedef typename range_detail::range<C>::type c_type;
public:
typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
};
}
#endif
@@ -0,0 +1,61 @@
// (C) Copyright Gennadiy Rozental 2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision$
//
// Description : simple helpers for creating cusom output manipulators
// ***************************************************************************
#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
// STL
#include <iosfwd>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace boost {
namespace unit_test {
namespace utils {
// ************************************************************************** //
// ************** custom manipulators helpers ************** //
// ************************************************************************** //
template<typename Manip>
struct custom_printer {
explicit custom_printer( std::ostream& ostr ) : m_ostr( &ostr ) {}
std::ostream& operator*() const { return *m_ostr; }
private:
std::ostream* const m_ostr;
};
//____________________________________________________________________________//
template<typename Uniq> struct custom_manip {};
//____________________________________________________________________________//
template<typename Uniq>
inline custom_printer<custom_manip<Uniq> >
operator<<( std::ostream& ostr, custom_manip<Uniq> const& ) { return custom_printer<custom_manip<Uniq> >( ostr ); }
//____________________________________________________________________________//
} // namespace utils
} // namespace unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP
@@ -0,0 +1,116 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#ifndef BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
#define BOOST_FT_CONFIG_COMPILER_HPP_INCLUDED
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if defined(BOOST_MSVC)
# if BOOST_MSVC < 1310
# error "unsupported compiler version"
# endif
# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
// enable clrcall calling covention (call to .NET managed code) when
// compiling with /clr
# if BOOST_MSVC >= 1400 && defined(__cplusplus_cli)
# ifndef BOOST_FT_CC_CLRCALL
# define BOOST_FT_CC_CLRCALL callable_builtin
# endif
# endif
// Intel x86 architecture specific calling conventions
# ifdef _M_IX86
# define BOOST_FT_COMMON_X86_CCs callable_builtin
# if BOOST_MSVC < 1400
// version 7.1 is missing a keyword to specify the thiscall cc ...
# ifndef BOOST_FT_CC_IMPLICIT_THISCALL
# define BOOST_FT_CC_IMPLICIT_THISCALL non_variadic|member|callable_builtin
# ifndef BOOST_FT_CONFIG_OK
# pragma message("INFO| /Gd /Gr /Gz will compiler options will cause")
# pragma message("INFO| a compile error.")
# pragma message("INFO| Reconfigure Boost.FunctionTypes in this case.")
# pragma message("INFO| This message can be suppressed by defining")
# pragma message("INFO| BOOST_FT_CONFIG_OK.")
# endif
# endif
# else
// ...introduced in version 8
# ifndef BOOST_FT_CC_THISCALL
# define BOOST_FT_CC_THISCALL non_variadic|member|callable_builtin
# endif
# endif
# endif
# endif
#elif defined(__GNUC__) && !defined(BOOST_INTEL_LINUX)
# if __GNUC__ < 3
# error "unsupported compiler version"
# endif
# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
# if defined(__i386__)
# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20439
# // see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29328
# if BOOST_WORKAROUND(__GNUC__,BOOST_TESTED_AT(4))
# ifndef BOOST_FT_CC_IMPLICIT
# define BOOST_FT_CC_IMPLICIT member|callable_builtin
# endif
# define BOOST_FT_COMMON_X86_CCs non_member|callable_builtin
# else
# define BOOST_FT_COMMON_X86_CCs callable_builtin
# endif
# else
# ifndef BOOST_FT_CC_IMPLICIT
# define BOOST_FT_CC_IMPLICIT callable_builtin
# endif
# endif
# endif
# if (defined(BOOST_FT_CC_CDECL) || defined(BOOST_FT_COMMON_X86_CCs)) \
&& !defined(__cdecl)
# define __cdecl __attribute__((__cdecl__))
# endif
# if (defined(BOOST_FT_CC_STDCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
&& !defined(__stdcall)
# define __stdcall __attribute__((__stdcall__))
# endif
# if (defined(BOOST_FT_CC_FASTCALL) || defined(BOOST_FT_COMMON_X86_CCs)) \
&& !defined(__fastcall)
# define __fastcall __attribute__((__fastcall__))
# endif
#elif defined(__BORLANDC__)
# if __BORLANDC__ < 0x550
# error "unsupported compiler version"
# elif __BORLANDC__ > 0x565
# pragma message("WARNING: library untested with this compiler version")
# endif
# ifdef BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
# define BOOST_FT_COMMON_X86_CCs callable_builtin
# endif
// syntactic specialities of cc specifier
# define BOOST_FT_SYNTAX(result,lparen,cc_spec,type_mod,name,rparen) \
result() cc_spec() lparen() type_mod() name() rparen()
#else
// only enable default calling convention
# define BOOST_FT_CC_IMPLICIT callable_builtin
#endif
#endif
@@ -0,0 +1,21 @@
subroutine chkhist(mrsym,nmax,ipk)
integer mrsym(63)
integer hist(0:63)
hist=0
do j=1,63
i=mrsym(j)
hist(i)=hist(i)+1
enddo
nmax=0
do i=0,63
if(hist(i).gt.nmax) then
nmax=hist(i)
ipk=i+1
endif
enddo
return
end subroutine chkhist